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: enable empty range by #2697

Merged
merged 1 commit into from Nov 6, 2023
Merged

feat: enable empty range by #2697

merged 1 commit into from Nov 6, 2023

Conversation

Taylor-lagrange
Copy link
Contributor

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

Enable case BY () like

SELECT 
    sum(metrics) RANGE '10m' FILL MAX
FROM t ALIGN '1h' by () FILL NULL;

The user explicitly specifies that the aggregation key is empty. In this case, there is no aggregation key. All data will be aggregated into a group, which is equivalent to using a random constant as the aggregation key. Therefore, in this case, the constant 1 is used directly as the aggregation key. The sql is rewrite by sqlparser to:

SELECT 
    sum(metrics) RANGE '10m' FILL MAX
FROM t ALIGN '1h' by (1) FILL NULL;

The work is mainly done by sqlparser. Here we just simply replace the version of sqlparser and add test cases.

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)

GreptimeTeam/sqlparser-rs#8

Copy link

codecov bot commented Nov 6, 2023

Codecov Report

Merging #2697 (4125b4e) into develop (395632c) will decrease coverage by 0.45%.
The diff coverage is n/a.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2697      +/-   ##
===========================================
- Coverage    85.13%   84.68%   -0.45%     
===========================================
  Files          762      762              
  Lines       121864   121864              
===========================================
- Hits        103746   103205     -541     
- Misses       18118    18659     +541     

Copy link
Collaborator

@fengjiachun fengjiachun left a comment

Choose a reason for hiding this comment

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

LGTM

@waynexia waynexia added this pull request to the merge queue Nov 6, 2023
Merged via the queue into GreptimeTeam:develop with commit bbaae92 Nov 6, 2023
16 checks passed
@Taylor-lagrange Taylor-lagrange deleted the feat-range-empty-by branch November 6, 2023 06:09
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