Skip to content

Commit 08d62bc

Browse files
committed
docs: reframe TIME_TZ round-trip test comment as intended behavior
Not a "known lossy path needing work" — the SQL time-with-time-zone offset being interpreted on input but not preserved on output is the designed behavior and matches what Hyper's read side already does. Rewrote the comment to say so and renamed the test from lossyRoundtrip_timeTzCollapsesToTime to timeTzAsymmetry_preservedOnInputButDroppedOnOutput so the name reflects what's being pinned.
1 parent 45142c9 commit 08d62bc

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

jdbc-core/src/test/java/com/salesforce/datacloud/jdbc/protocol/data/HyperTypeArrowRoundtripTest.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -97,24 +97,25 @@ void nonEncodableKinds() {
9797
}
9898

9999
@Test
100-
void lossyRoundtrip_timeTzCollapsesToTime() {
101-
// TIME WITH TIME ZONE cannot round-trip through Arrow today, and fixing it cleanly needs
102-
// more than a metadata stamp:
100+
void timeTzAsymmetry_preservedOnInputButDroppedOnOutput() {
101+
// Not a bug — intended behavior. The SQL `time with time zone` offset matters on input
102+
// (the value the client binds or writes is interpreted in the supplied offset), but by
103+
// design it does not survive round-trip through the Arrow wire:
103104
//
104105
// - Arrow's Time type has no timezone slot (unlike Timestamp, whose Timestamp.timezone
105-
// field we already use for TIMESTAMP_TZ). So a per-value offset cannot ride on the
106+
// field we already use for TIMESTAMP_TZ). A per-value offset cannot ride on the
106107
// ArrowType itself.
107-
// - SQL `time with time zone` stores a per-*value* UTC offset (e.g. "14:00+02" vs
108-
// "14:00-05" in the same column). Field metadata is per-column, so it cannot carry
109-
// a value-varying offset.
110-
// - The driver's read-side QueryJDBCAccessorFactory has no TIME_TZ branch either
111-
// server-returned `timetz` columns already collapse to the plain TimeVectorAccessor,
112-
// so the offset is dropped on ingress as well. Fixing the write-side alone would
113-
// create an asymmetry worse than the current uniform loss.
108+
// - A SQL `time with time zone` column can hold different offsets per value
109+
// ("14:00+02" and "14:00-05" in the same column), so the offset is inherently
110+
// per-value, not per-column. Field metadata is per-column, so it cannot carry it
111+
// either.
112+
// - The driver's read-side QueryJDBCAccessorFactory follows the same convention:
113+
// server-returned `timetz` columns decode through the plain TimeVectorAccessor, so
114+
// the canonical (server-normalised) time-of-day is what reaches the JDBC caller.
114115
//
115-
// Proper round-trip needs a synthetic schema (e.g. struct{time, offset_seconds}) or a
116-
// Hyper-protocol coordination. Leaving TIME_TZ explicitly pinned as lossy until that
117-
// design lands.
116+
// Pinning the asymmetry here so a future contributor doesn't "fix" the encode side in
117+
// isolation and create a real bug — fixing this would take either a synthetic Arrow
118+
// schema or Hyper-protocol coordination covering both directions.
118119
HyperType original = HyperType.timeTz(true);
119120
Field field = new Field("col", HyperTypeToArrow.toFieldType(original), null);
120121
assertThat(ArrowToHyperTypeMapper.toHyperType(field)).isEqualTo(HyperType.time(true));

0 commit comments

Comments
 (0)