fix(bindings): fix distance return types; add + shift alias for tstzset/tstzspan+interval#107
fix(bindings): fix distance return types; add + shift alias for tstzset/tstzspan+interval#107estebanzimanyi wants to merge 1 commit into
Conversation
…et/tstzspan+interval Distance operators for integer and date spans were registered with INTEGER/BIGINT return types but the C++ executor wrote DOUBLE values → INTERNAL error at runtime. tstzset/tstzspan distance was registered as DOUBLE but callers expect INTERVAL (2 days, not 172800.0). Changes: - Distance_span_value / Distance_value_span: change int/bigint/date cases to BinaryExecutor<..., int32_t/int64_t> using DatumGetInt32/Int64; change tstzspan case to BinaryExecutor<..., interval_t> via SecsToInterval. - Distance_span_span: replace single double-returning executor with a type-dispatching switch (int32/int64/double/interval_t per span type); uses distance_tstzspan_tstzspan for the tstzspan branch. - Distance_set_value / Distance_value_set / Distance_set_set: change tstzset branch from double to interval_t, converting via SecsToInterval. - set.cpp / span.cpp: update tstzset distance registrations to INTERVAL; add "+"(tstzset, INTERVAL) and "+"(tstzspan, INTERVAL) as shift aliases. - time_util.hpp: add SecsToInterval helper (seconds → DuckDB interval_t). - test/sql/parity/009_time_ops.test: activate all 4 assertions (previously inside mode skip). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Consolidation note — overlaps with #106See #106 comment for the full overlap matrix. Both PRs touch distance return types in Maintainer call which to keep, which to fold. |
|
Superseded by the consolidated parity batch at #126 ( The work on this branch — distance return types + tstzset/tstzspan+interval alias — is now part of the squashed addressable-parity surface that brings MobilityDuck to 943/943 = 100.0% of the active addressable temporal + geo names. Closing to keep the review queue focused on the three active stacked PRs (#126 → #130 → #129) and the four orthogonal PRs (#105 / #111 / #113 / #117 / #120). Branch |
Summary
INTEGER/BIGINTreturn types but the C++ executor wroteDOUBLEvalues →INTERNAL errorat runtime. Fixed by usingBinaryExecutor<..., int32_t/int64_t>withDatumGetInt32/Int64.tstzspandistance was registered asDOUBLEbut callers expectINTERVAL(e.g.2 days, not172800.0). Fixed to returninterval_tviaSecsToInterval.+andshiftaliases fortstzset/tstzspan+interval(DuckDB cannot define custom infix operators, so+is registered as a named function alias).Test plan
intspan '[1,3]' <-> intspan '[5,7]'returns2(INTEGER)datespan '[2000-01-01,2000-01-03]' <-> datespan '[2000-01-10,2000-01-15]'returns correct day counttstzspan '[2000-01-01,2000-01-03]' <-> tstzspan '[2000-01-10,2000-01-15]'returns7 daysINTERVAL🤖 Generated with Claude Code