Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make query be aware of timezone setting #3175

Merged

Conversation

killme2008
Copy link
Contributor

@killme2008 killme2008 commented Jan 16, 2024

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

Try to aware of timezone setting for TypeConversionRule, changes:

  • Added ExtensionAnalyzerRule that extends DataFusion AnalyzerRule to accept QueryEngineContext as the second parameter.
  • Implement ExtensionAnalyzerRule for TypeConversionRule.
  • Optimize by extension analyzer rules at first in DfLogicalPlanner and LogicalOptimizer.
  • Fixed MySQL show variables time_zone can't work.
  • Adds timezone sqlness test.
  • Make Date, Timestamp and DateTime parsing from string value aware of timezone.
  • Make UDF functions aware of timezone.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR does not require documentation updates.

Refer to a related PR or issue link (optional)

#2907

@github-actions github-actions bot added docs-not-required This change does not impact docs. Size: M labels Jan 16, 2024
@waynexia waynexia changed the title feat: let TypeConversionRule aware query context timezone setting feat: let TypeConversionRule aware of query context timezone setting Jan 16, 2024
@github-actions github-actions bot added Size: L and removed Size: M labels Jan 17, 2024
@killme2008 killme2008 marked this pull request as ready for review January 17, 2024 02:36
@github-actions github-actions bot added docs-required This change requires docs update. and removed docs-not-required This change does not impact docs. labels Jan 17, 2024
Copy link

codecov bot commented Jan 17, 2024

Codecov Report

Attention: 27 lines in your changes are missing coverage. Please review.

Comparison is base (5e89472) 85.81% compared to head (7c3bd19) 85.35%.
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3175      +/-   ##
==========================================
- Coverage   85.81%   85.35%   -0.46%     
==========================================
  Files         833      840       +7     
  Lines      137109   137929     +820     
==========================================
+ Hits       117662   117732      +70     
- Misses      19447    20197     +750     

@killme2008 killme2008 force-pushed the feature/type-conversion-aware-timezone branch from 4358217 to c966468 Compare January 17, 2024 03:51
src/datatypes/src/value.rs Outdated Show resolved Hide resolved
src/query/src/optimizer.rs Show resolved Hide resolved
src/sql/src/statements.rs Show resolved Hide resolved
src/query/src/optimizer.rs Outdated Show resolved Hide resolved
src/common/time/src/util.rs Show resolved Hide resolved
@killme2008
Copy link
Contributor Author

I'll rebase #3193 after it is merged.

@killme2008 killme2008 force-pushed the feature/type-conversion-aware-timezone branch from c966468 to 8cf131e Compare January 18, 2024 13:06
@killme2008 killme2008 force-pushed the feature/type-conversion-aware-timezone branch from 0a00d8a to 43f1003 Compare January 19, 2024 12:56
@github-actions github-actions bot added Size: XL and removed Size: L labels Jan 19, 2024
@killme2008
Copy link
Contributor Author

killme2008 commented Jan 19, 2024

@waynexia @v0y4g3r Please take another look. Already made Date and DateTime parsing from string value be aware of timezone.

I think all the queries will be aware of the time zone right now except in functions, it will be done in the next PR.

@github-actions github-actions bot added Size: L and removed Size: XL labels Jan 19, 2024
@github-actions github-actions bot added Size: XL and removed Size: L labels Jan 19, 2024
src/sql/src/statements.rs Outdated Show resolved Hide resolved
src/script/src/python/engine.rs Outdated Show resolved Hide resolved
src/query/src/query_engine/state.rs Outdated Show resolved Hide resolved
src/cmd/src/cli/repl.rs Outdated Show resolved Hide resolved
@killme2008
Copy link
Contributor Author

killme2008 commented Jan 22, 2024

@waynexia @v0y4g3r PTAL

Copy link
Contributor

@v0y4g3r v0y4g3r left a comment

Choose a reason for hiding this comment

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

Generally LGTM

src/common/time/src/date.rs Outdated Show resolved Hide resolved
src/common/time/src/timestamp.rs Outdated Show resolved Hide resolved
src/query/src/parser.rs Show resolved Hide resolved
Copy link
Member

@waynexia waynexia left a comment

Choose a reason for hiding this comment

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

Others LGTM, except the from/to local tz

killme2008 and others added 2 commits January 22, 2024 21:33
Co-authored-by: Lei, HUANG <6406592+v0y4g3r@users.noreply.github.com>
@killme2008
Copy link
Contributor Author

Others LGTM, except the from/to local tz

Renamed the local to system in 7c3bd19

@killme2008 killme2008 added this pull request to the merge queue Jan 22, 2024
Merged via the queue into GreptimeTeam:main with commit 6a12c27 Jan 22, 2024
15 checks passed
@killme2008 killme2008 deleted the feature/type-conversion-aware-timezone branch January 22, 2024 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-required This change requires docs update.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants