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: support rewrite basic raw query in influxql #683

Merged
merged 4 commits into from
Mar 8, 2023

Conversation

Rachelint
Copy link
Contributor

@Rachelint Rachelint commented Mar 2, 2023

Which issue does this PR close?

Part of #698

What changes are included in this PR?

See #698

  • In this pr, we will support the basic influxql which is compatible with sql
    • Projection. Most scalar functions and binary operation.
    • From. Just from single measurement.
    • Where. Support filters exclude regex (~=).
    • Group by (only tags allowed).
    • Limit and offset.
    SELECT a, sin(b), c FROM influxql_test WHERE a < 4 and b > 4.5 GROUP BY c LIMIT 1 OFFSET 0
    
  • Something specified in influxql will be supported:
    • Solve regex and wildcard in projection (exclude nested function call).
    • Solve regex and wildcard in group by.

Are there any user-facing changes?

User can use some simple raw queries in influxql to query data in CeresDB.

How does this change test

Test by ut.

@Rachelint Rachelint force-pushed the support-simple-influxql branch 2 times, most recently from f8fa257 to df38fee Compare March 5, 2023 23:55
@Rachelint Rachelint changed the title feat: support simple raw query in influxql feat: support basic raw query in influxql Mar 6, 2023
@Rachelint Rachelint force-pushed the support-simple-influxql branch 2 times, most recently from 7847b0b to cc210ad Compare March 7, 2023 07:01
@Rachelint Rachelint changed the title feat: support basic raw query in influxql feat: support rewrite basic raw query in influxql Mar 7, 2023
@Rachelint Rachelint marked this pull request as ready for review March 7, 2023 07:02
sql/src/influxql/mod.rs Outdated Show resolved Hide resolved
sql/src/influxql/mod.rs Outdated Show resolved Hide resolved
sql/src/influxql/mod.rs Outdated Show resolved Hide resolved
sql/src/influxql/mod.rs Outdated Show resolved Hide resolved
sql/src/influxql/util.rs Outdated Show resolved Hide resolved
sql/src/influxql/util.rs Show resolved Hide resolved
sql/src/planner.rs Show resolved Hide resolved
sql/src/influxql/stmt_rewriter.rs Show resolved Hide resolved
@jiacai2050
Copy link
Contributor

User can use some simple raw queries in influxql to query data in CeresDB.

Give some example which kinds of QL are supported by this PR.

sql/Cargo.toml Show resolved Hide resolved
sql/src/influxql/mod.rs Show resolved Hide resolved
sql/src/influxql/stmt_rewriter.rs Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Mar 7, 2023

Codecov Report

Merging #683 (fb24319) into main (f79890b) will increase coverage by 0.05%.
The diff coverage is 68.81%.

❗ Current head fb24319 differs from pull request most recent head 2c415b5. Consider uploading reports for the commit 2c415b5 to get more accurate results

@@            Coverage Diff             @@
##             main     #683      +/-   ##
==========================================
+ Coverage   67.55%   67.60%   +0.05%     
==========================================
  Files         281      285       +4     
  Lines       44343    44788     +445     
==========================================
+ Hits        29956    30281     +325     
- Misses      14387    14507     +120     
Impacted Files Coverage Δ
analytic_engine/src/instance/open.rs 80.48% <ø> (+0.24%) ⬆️
analytic_engine/src/table/mod.rs 79.89% <ø> (-0.32%) ⬇️
server/src/grpc/storage_service/prom_query.rs 54.28% <0.00%> (-0.29%) ⬇️
sql/src/frontend.rs 0.00% <0.00%> (ø)
sql/src/influxql/mod.rs 0.00% <0.00%> (ø)
sql/src/influxql/planner.rs 0.00% <0.00%> (ø)
sql/src/lib.rs 100.00% <ø> (ø)
sql/src/planner.rs 91.91% <25.00%> (-0.48%) ⬇️
analytic_engine/src/instance/flush_compaction.rs 69.54% <66.66%> (+2.25%) ⬆️
sql/src/influxql/stmt_rewriter.rs 71.42% <71.42%> (ø)
... and 3 more

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

@Rachelint Rachelint force-pushed the support-simple-influxql branch 2 times, most recently from 6790141 to f25cab7 Compare March 8, 2023 03:26
Copy link
Contributor

@jiacai2050 jiacai2050 left a comment

Choose a reason for hiding this comment

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

LGTM

@jiacai2050 jiacai2050 added this pull request to the merge queue Mar 8, 2023
Merged via the queue into apache:main with commit 00db4f6 Mar 8, 2023
chunshao90 pushed a commit to chunshao90/ceresdb that referenced this pull request May 15, 2023
* draft.

* implement influxql stmt rewriter.

* add tests.

* address CR.
@Rachelint Rachelint deleted the support-simple-influxql branch May 27, 2023 12:18
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.

4 participants