Skip to content

fix: store bigint Date64 inputs without conversion - #83

Merged
jheer merged 1 commit into
uwdata:mainfrom
Query-farm:upstream/date64-bigint
Nov 10, 2026
Merged

jheer merged 1 commit into
uwdata:mainfrom
Query-farm:upstream/date64-bigint

Conversation

@rustyconover

Copy link
Copy Markdown
Contributor

Building a millisecond date column from bigint values currently throws Cannot mix BigInt and other types because toDateMillisecond applies number arithmetic to every input. This is the Date64 counterpart of the timestamp fix in #79.

columnFromArray([1745152496123n], dateMillisecond()); // TypeError before this change

With this change, a bigint input represents the stored 64-bit value and is kept as-is, matching how timestamp columns treat bigint inputs. number and Date inputs are still aligned to the start of their UTC day, so existing behavior is unchanged.

Keeping bigint inputs unaligned lets existing Date64 data be copied losslessly. Other writers do not always day-align Date64 values. For example, Arrow JS vectorFromArray([new Date(1745152496123)], new DateMillisecond()) stores 1745152496123, and Flechette decodes it as that value. Today, re-encoding through a number input silently truncates it to midnight. Passing it as a bigint now preserves it. If you would rather have bigint inputs day-aligned too, I'm happy to change that.

The change is limited to toDateMillisecond and the Date docs. New tests cover builder batches, nulls, signed int64 limits, mixed number/Date/bigint inputs, copying non-day-aligned Arrow JS data, and IPC stream/file round trips. Arrow JS independently checks the encoded int64 buffers and validity.

Validation:

  • 221 tests pass on Node 26; lint and the bundle/declaration builds pass.
  • Before the fix, all 5 new regression tests fail with the BigInt/number arithmetic error.

Building a millisecond date column from bigint values threw because toDateMillisecond mixed bigint inputs with number arithmetic. A bigint input now represents the stored 64-bit value and is kept as-is, matching how timestamp columns treat bigint inputs. Number and Date inputs are still aligned to UTC days.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jheer
jheer merged commit dfa264c into uwdata:main Nov 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants