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: implement Display for Expr #69

Merged
merged 15 commits into from
Jul 20, 2023
Merged

Conversation

parkma99
Copy link
Contributor

@parkma99 parkma99 commented Jun 26, 2023

#55
Hello @waynexia , is #55 requesting impl fmt for Expr??😕

@yuanbohan
Copy link
Contributor

yuanbohan commented Jun 27, 2023

close #55 Hello @waynexia , is #55 requesting impl fmt for Expr??😕

It should be fmt::Display, but I got your idea. 😄

src/parser/parse.rs Outdated Show resolved Hide resolved
@parkma99
Copy link
Contributor Author

parkma99 commented Jun 30, 2023

Hello @yuanbohan , Current not passed test cases is below.

Case 1 :

left: `"a offset 1m"`,
 right: `"a offset 60s"`',

Case 2:

 left: `"a - on (b) group_left (x, y) c"`,
 right: `"a - on (b) group_left (y, x) c"`'

Case 1 because of Duration not imply fmt:Display, then I found a Crate duration_string, Is it need to imported?

Case 2 because of output is no ordered.

@yuanbohan
Copy link
Contributor

Case 1 because of Duration not imply fmt:Display, then I found a Crate duration_string, Is it need to imported?

Go ahead, and if it is ok for you, you can commit it in a separated PR, and I will merge it ASAP if it does not break any of the exist test cases

@yuanbohan
Copy link
Contributor

Please note that #71 has fixed a bug, which may cause this PR conflicted

@parkma99
Copy link
Contributor Author

parkma99 commented Jul 15, 2023

{__name__="a"}
a @ 10
is now failed to pass test cases from https://github.com/prometheus/prometheus/blob/main/promql/parser/printer_test.go

@yuanbohan
Copy link
Contributor

hi @parkma99, is this PR ready? or half done with some features to do in next PR? Or if you do not have enough time, I can continue your work to make rest of the test cases passed.
Thanks for your time and ideas ❤️

@parkma99
Copy link
Contributor Author

or if you do not have enough time, I can continue your work to make rest of the test cases passed.

Thanks you @yuanbohan Recently I work on my paper and job hunting.

@yuanbohan yuanbohan force-pushed the expr_to_promql branch 4 times, most recently from e9f3447 to fa3a8bb Compare July 18, 2023 11:25
@yuanbohan yuanbohan marked this pull request as ready for review July 19, 2023 03:28
@yuanbohan yuanbohan changed the title convert a parsed Expr back to PromQL literal feat: PromQL Expr ast to_string Jul 19, 2023
@codecov
Copy link

codecov bot commented Jul 19, 2023

Codecov Report

Merging #69 (b7aa7a1) into main (7213b6c) will decrease coverage by 0.01%.
The diff coverage is 99.01%.

Changes have been made to critical files, which contain lines commonly executed in production. Learn more

@@            Coverage Diff             @@
##             main      #69      +/-   ##
==========================================
- Coverage   98.63%   98.63%   -0.01%     
==========================================
  Files          12       13       +1     
  Lines        4921     5358     +437     
==========================================
+ Hits         4854     5285     +431     
- Misses         67       73       +6     
Impacted Files Coverage Δ
src/label/mod.rs 98.52% <98.52%> (ø)
src/parser/ast.rs Critical 96.14% <98.65%> (+1.10%) ⬆️
src/label/matcher.rs 100.00% <100.00%> (ø)
src/parser/function.rs 100.00% <100.00%> (ø)
src/parser/parse.rs Critical 99.95% <100.00%> (-0.01%) ⬇️
src/util/duration.rs 100.00% <100.00%> (ø)
src/util/mod.rs 100.00% <100.00%> (ø)
src/util/visitor.rs 92.43% <100.00%> (ø)

... and 1 file with indirect coverage changes

@yuanbohan yuanbohan changed the title feat: PromQL Expr ast to_string feat: implement Display for Expr Jul 19, 2023
@yuanbohan yuanbohan changed the title feat: implement Display for Expr feat:implement Display for Expr Jul 19, 2023
@yuanbohan yuanbohan changed the title feat:implement Display for Expr feat(to_string):implement Display for Expr Jul 19, 2023
@yuanbohan yuanbohan changed the title feat(to_string):implement Display for Expr feat:implement Display for Expr Jul 19, 2023
@yuanbohan yuanbohan changed the title feat:implement Display for Expr feat: implement Display for Expr Jul 19, 2023
@yuanbohan yuanbohan requested a review from evenyag July 19, 2023 04:25
waynexia
waynexia previously approved these changes Jul 19, 2023
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.

LGTM

src/label/matcher.rs Show resolved Hide resolved
src/label/matcher.rs Outdated Show resolved Hide resolved
src/label/matcher.rs Outdated Show resolved Hide resolved
src/label/mod.rs Outdated Show resolved Hide resolved
src/parser/ast.rs Outdated Show resolved Hide resolved
src/parser/ast.rs Outdated Show resolved Hide resolved
src/parser/function.rs Outdated Show resolved Hide resolved
src/util/duration.rs Show resolved Hide resolved
evenyag
evenyag previously approved these changes Jul 19, 2023
Copy link
Contributor

@evenyag evenyag left a comment

Choose a reason for hiding this comment

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

Rest LGTM.

src/util/duration.rs Outdated Show resolved Hide resolved
src/util/duration.rs Outdated Show resolved Hide resolved
evenyag
evenyag previously approved these changes Jul 20, 2023
src/util/duration.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@evenyag evenyag left a comment

Choose a reason for hiding this comment

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

LGTM

@evenyag evenyag merged commit 36fca07 into GreptimeTeam:main Jul 20, 2023
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