Skip to content

Conversation

@akravchukdremio
Copy link

@akravchukdremio akravchukdremio commented Jan 15, 2026

Rationale for this change

Fixes #48866. The Gandiva precompiled time functions castTIMESTAMP_utf8 and castTIME_utf8 currently reject timestamp and time string literals with more than 3 subsecond digits (beyond millisecond precision), throwing an "Invalid millis" error. This behavior is inconsistent with other implementations.

What changes are included in this PR?

  • Fixed castTIMESTAMP_utf8 and castTIME_utf8 functions to truncate subseconds beyond 3 digits instead of throwing an error
  • Updated tests. Replaced error-expecting tests with truncation verification tests and added edge cases

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions github-actions bot added the awaiting review Awaiting review label Jan 15, 2026
@github-actions
Copy link

⚠️ GitHub issue #48866 has been automatically assigned in GitHub to PR creator.

@xxlaykxx
Copy link
Contributor

@kou Could you plz take a look?

Comment on lines 750 to 754
// Truncate to 3 digits (milliseconds precision) if more digits are provided
while (sub_seconds_len > 3) {
ts_fields[TimeFields::kSubSeconds] /= 10;
sub_seconds_len--;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we factor out this common code?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for review, moved common code in the separate inline function

@kou
Copy link
Member

kou commented Jan 22, 2026

@xxlaykxx Could you also review this? We don't have enough maintainers for Gandiva.

@kou
Copy link
Member

kou commented Jan 22, 2026

@akravchukdremio Could you rebase on main to fix CI failures?

@akravchukdremio
Copy link
Author

@akravchukdremio Could you rebase on main to fix CI failures?

Sure, rebased PR

@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C++][Gandiva] castTIMESTAMP_utf8 and castTIME_utf8 should truncate subseconds beyond milliseconds, not reject them

3 participants