Skip to content

GH-1540: Bind TIMESTAMP parameters in the vector unit and accept java.time values in Flight SQL JDBC - #53

Merged
xxlaykxx merged 1 commit into
dremio:dremio_27.0_23_19from
xxlaykxx:GH-1540-dremio_27.0_23_19
Dec 3, 2026
Merged

xxlaykxx merged 1 commit into
dremio:dremio_27.0_23_19from
xxlaykxx:GH-1540-dremio_27.0_23_19

Conversation

@xxlaykxx

@xxlaykxx xxlaykxx commented Dec 3, 2026

Copy link
Copy Markdown

What's Changed

Cherry-pick of #51 (backport of apache#1542, the fix for apache#1540) onto dremio_27.0_23_19. The upstream PR is still open, not merged. The pick applied without conflicts and includes the review fixes made upstream so far.

TIMESTAMP prepared statement parameters in the Flight SQL JDBC driver were bound with the wrong value unless the parameter was in milliseconds: the epoch-millisecond value from Avatica was written unchanged into second, microsecond and nanosecond vectors. java.time values were rejected.

The change is in TimestampAvaticaParameterConverter (flight/flight-sql-jdbc-core):

  • Unit. java.sql.Timestamp and java.util.Date values are converted to the unit of the parameter vector, for all eight timestamp vector types.
  • java.time values. setObject accepts LocalDateTime, Instant, OffsetDateTime and ZonedDateTime at full precision. Instant, OffsetDateTime and ZonedDateTime are rejected for a parameter without a timezone. A vector timezone given as an offset, such as +03:00, is applied; an unknown timezone name fails with DateTimeException.
  • Longs. Values bound with setLong or setObject(Long) are written unchanged, as before.
  • Overflow. A value that does not fit in the unit fails with ArithmeticException instead of binding a wrong value.

Not changed

setTimestamp on a parameter with a timezone still binds the wall-clock time of the java.sql.Timestamp, not its instant. This matches what getTimestamp returns when reading; the reasoning is in the upstream PR.

Testing

  • The driver tests on this branch (mvn -pl flight/flight-sql-jdbc-core -am verify): 1232 tests, 0 failures, 3 errors. The 3 errors are TLS connection tests that need testing/data/flight/cert0.pem; the testing submodule was not checked out locally. The style and static checks pass.
  • Not tested end to end against a Dremio server.

🤖 Generated with Claude Code

…t java.time values in Flight SQL JDBC (apache#51)

* apacheGH-1540: Bind TIMESTAMP parameters in the vector unit and accept java.time values

Convert TIMESTAMP parameter values in the Flight SQL JDBC driver to the unit
of the parameter vector instead of writing milliseconds into every unit, and
accept LocalDateTime, Instant, OffsetDateTime and ZonedDateTime at full
precision.

Closes apache#1540.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit df71acc)

* Address review feedback

- Write values bound with setLong or setObject(Long) to the timestamp
  vector unchanged, as before, instead of reading them as milliseconds
- Add a test that binds a long to each unit, with and without a time zone

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit adf1b16)

* Address review feedback

Parse numeric offsets in the time zone of a timestamp vector, and bind
values at the lower bound of the vector unit without a false overflow.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 35c0ae1)

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit c0c9b19)
@xxlaykxx
xxlaykxx merged commit b4fe4a1 into dremio:dremio_27.0_23_19 Dec 3, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants