Skip to content

fix: parsing time index column option#865

Merged
MichaelScofield merged 5 commits intoGreptimeTeam:developfrom
killme2008:feat/refactor-time-index-parser
Jan 13, 2023
Merged

fix: parsing time index column option#865
MichaelScofield merged 5 commits intoGreptimeTeam:developfrom
killme2008:feat/refactor-time-index-parser

Conversation

@killme2008
Copy link
Copy Markdown
Member

@killme2008 killme2008 commented Jan 11, 2023

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

Try to improve #697 .

The parser is not implemented well, it can't parse the column definition as below:

  ts     TIMESTAMP TIME INDEX DEFAULT CURRENT_TIMESTAMP,

Because it assumes that the TIME INDEX option is always present at the end, but it's not expected.

In this PR, it treats TIME INDEX as a normal column option just like NOT NULL etc., then after parsing all column options, we move the TIME INDEX from options to table constraints and do some validations.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.

Refer to a related PR or issue link (optional)

@killme2008 killme2008 marked this pull request as ready for review January 11, 2023 08:36
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 11, 2023

Codecov Report

Merging #865 (1f30532) into develop (a9b42b4) will decrease coverage by 0.15%.
The diff coverage is 88.15%.

@@             Coverage Diff             @@
##           develop     #865      +/-   ##
===========================================
- Coverage    86.32%   86.16%   -0.16%     
===========================================
  Files          422      425       +3     
  Lines        55668    56261     +593     
===========================================
+ Hits         48056    48479     +423     
- Misses        7612     7782     +170     
Flag Coverage Δ
rust 86.16% <88.15%> (-0.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/datanode/src/sql/create.rs 88.48% <ø> (-0.59%) ⬇️
src/sql/src/error.rs 81.96% <0.00%> (ø)
src/sql/src/parsers/create_parser.rs 94.69% <88.54%> (-2.40%) ⬇️
src/object-store/src/test_util.rs 0.00% <0.00%> (-100.00%) ⬇️
src/datanode/src/instance.rs 50.00% <0.00%> (-15.87%) ⬇️
src/meta-srv/src/handler/collect_stats_handler.rs 81.08% <0.00%> (-13.52%) ⬇️
tests-integration/src/test_util.rs 87.55% <0.00%> (-11.97%) ⬇️
src/servers/src/error.rs 35.18% <0.00%> (-6.64%) ⬇️
src/storage/src/sst/parquet.rs 92.99% <0.00%> (-6.11%) ⬇️
src/catalog/src/remote/manager.rs 68.02% <0.00%> (-3.03%) ⬇️
... and 48 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Copy Markdown
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.

That long if else chain is too cool🤩

Comment thread src/sql/src/parsers/create_parser.rs
Comment thread src/sql/src/parsers/create_parser.rs
Comment thread src/sql/src/parsers/create_parser.rs
Comment thread src/sql/src/parsers/create_parser.rs Outdated
Comment thread src/sql/src/parsers/create_parser.rs
@killme2008 killme2008 force-pushed the feat/refactor-time-index-parser branch from 4d349ab to 01c267d Compare January 12, 2023 11:07
@killme2008
Copy link
Copy Markdown
Member Author

@MichaelScofield @waynexia PTAL

Copy link
Copy Markdown
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.

Looking good

@MichaelScofield MichaelScofield merged commit d195a22 into GreptimeTeam:develop Jan 13, 2023
paomian pushed a commit to paomian/greptimedb that referenced this pull request Oct 19, 2023
* fix: parsing time index column option

* test: adds more cases for creating table

* chore: by CR comments

* feat: validate time index constraint in parser

* chore: improve error msg
@killme2008 killme2008 deleted the feat/refactor-time-index-parser branch January 16, 2024 09:42
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.

3 participants