fix(bindings): fix distance return types; add + shift alias for tstzset/tstzspan+interval#107
Open
estebanzimanyi wants to merge 1 commit intomainMobilityDB/MobilityDuck:mainfrom
fix/span-distance-return-typesMobilityDB/MobilityDuck:fix/span-distance-return-typesCopy head branch name to clipboard
Open
fix(bindings): fix distance return types; add + shift alias for tstzset/tstzspan+interval#107estebanzimanyi wants to merge 1 commit intomainMobilityDB/MobilityDuck:mainfrom fix/span-distance-return-typesMobilityDB/MobilityDuck:fix/span-distance-return-typesCopy head branch name to clipboard
estebanzimanyi wants to merge 1 commit intomainMobilityDB/MobilityDuck:mainfrom
fix/span-distance-return-typesMobilityDB/MobilityDuck:fix/span-distance-return-typesCopy head branch name to clipboard
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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