Skip to content

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

Merged
xxlaykxx merged 3 commits into
dremio:dremio_27.0_26_20from
xxlaykxx:GH-1540-dremio_27.0_26_20
Dec 3, 2026
Merged

xxlaykxx merged 3 commits into
dremio:dremio_27.0_26_20from
xxlaykxx:GH-1540-dremio_27.0_26_20

Conversation

@xxlaykxx

@xxlaykxx xxlaykxx commented Dec 1, 2026

Copy link
Copy Markdown

What's Changed

Cherry-pick of apache#1542 (fix for apache#1540) onto dremio_27.0_26_20. The upstream PR is still open, not merged. The pick applied without conflicts.

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. The value is 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.
  • 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): 1307 tests, 0 failures, 6 errors. The 6 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

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)
@github-actions

This comment has been minimized.

- 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)
@xxlaykxx
xxlaykxx requested a review from lriggs December 2, 2026 09:59
lriggs
lriggs previously approved these changes Dec 2, 2026
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)
@xxlaykxx
xxlaykxx merged commit c0c9b19 into dremio:dremio_27.0_26_20 Dec 3, 2026
10 checks passed
xxlaykxx added a commit that referenced this pull request Dec 3, 2026
…t java.time values in Flight SQL JDBC (#51) (#53)

* 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.


(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


(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.


(cherry picked from commit 35c0ae1)

---------


(cherry picked from commit c0c9b19)

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants