Skip to content

Conversation

@Omega359
Copy link
Contributor

Which issue does this PR close?

Part of #19025

Rationale for this change

Expand support for binning time data types.

What changes are included in this PR?

Code, tests.

Are these changes tested?

Yes, slt tests.

Are there any user-facing changes?

No.

@github-actions github-actions bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Dec 15, 2025
@Omega359 Omega359 marked this pull request as ready for review December 15, 2025 19:36
Copy link
Member

@martin-g martin-g left a comment

Choose a reason for hiding this comment

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

Consider adding the following constants:

const NANOS_PER_MILLI: i64 = 1_000_000;
const NANOS_PER_SEC: i64 = 1_000_000_000;
const NANOS_PER_MICRO: i64 = 1_000;

@Omega359
Copy link
Contributor Author

Thanks for the review @martin-g. I've implemented your review feedback - sorry for the numerous bugs in that initial version :(

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Dec 17, 2025
Comment on lines +172 to +173
Time32(array_type),
Time32(array_type),
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you explain why for time we require the expression & origin arguments to have the same granularity in terms of time units, whereas for timestamps above we seem to always have origin as Nanoseconds regardless of the expression granularity?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It didn't occur to me essentially :/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I took a look at this and it's a bit more than just the timeunit - it's the type. For time32 there is just two timeunits supported - Second and Millisecond. For Time64 it's Microsecond and Nanosecond.

Supporting a mix of those I think would be unnecessary. Forcing a single type (Time64(Nanosecond)) might work but I don't see it as beneficial really. Are you of a different opinion?

Copy link
Contributor

Choose a reason for hiding this comment

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

I was more thinking of trying to simplify the signature (which looks a bit gnarly) and potentially the implementation too. In terms of actual functionality it should be fine.

@Jefffrey Jefffrey added this pull request to the merge queue Dec 23, 2025
Merged via the queue into apache:main with commit 4a1f69f Dec 23, 2025
28 checks passed
@Jefffrey
Copy link
Contributor

Thanks @Omega359 & @martin-g

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation functions Changes to functions implementation sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants