Skip to content

Conversation

@codetyri0n
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

This PR makes the extract expression timezone aware. The configuration of time zone (example - SET datafusion.execution.time_zone = '+04:00';) is now recognised and the extract statement correspondingly returns the right results through date_part.

What changes are included in this PR?

Are these changes tested?

Yes (slt)

Are there any user-facing changes?

Yes

@github-actions github-actions bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Oct 31, 2025
@codetyri0n
Copy link
Contributor Author

codetyri0n commented Oct 31, 2025

CC: @Omega359 @comphead

@Omega359
Copy link
Contributor

I haven't had a chance to go over this in detail but can we add some tests to the .slt to test where the timestamp is being provided with a timezone? I didn't see any from a quick look.

@github-actions github-actions bot added the sql SQL Planner label Nov 1, 2025
@codetyri0n codetyri0n changed the title Feat: Make extract (date_part) timezone aware Feat: Make extract SQL expression timezone aware Nov 1, 2025
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Nov 1, 2025
@codetyri0n
Copy link
Contributor Author

I haven't had a chance to go over this in detail but can we add some tests to the .slt to test where the timestamp is being provided with a timezone? I didn't see any from a quick look.

with the introduction of the tests recommended, it led to making extract independent from date_part --> it does not use the date_part udf. Lmk if you have any concerns.
Summarizing it here:

  • date_part AND extract are now timezone config efficient
  • extract is now registered as a separate datetime function
  • corresponding changes made to mod.rs files and planner
  • slt files and the test cases impacted have been modified accordingly (verified locally)

@Omega359
Copy link
Contributor

Omega359 commented Nov 2, 2025

I'll try and review this tomorrow though reading that extract was, err, extracted to a new function is a surprise.

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 sql SQL Planner sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract sql expression no longer is timezone aware

2 participants