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

[GIE Compiler] Support Case When Expression in Logical and Physical Plan #2918

Merged
merged 12 commits into from
Jul 3, 2023

Conversation

shirly121
Copy link
Collaborator

What do these changes do?

as titled.

Related issue number

#2686

@codecov-commenter
Copy link

codecov-commenter commented Jun 20, 2023

Codecov Report

Merging #2918 (37fb699) into main (ad4aea1) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2918   +/-   ##
=======================================
  Coverage   42.37%   42.37%           
=======================================
  Files          99       99           
  Lines       10649    10649           
=======================================
  Hits         4512     4512           
  Misses       6137     6137           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ad4aea1...37fb699. Read the comment docs.

import java.util.ArrayList;
import java.util.List;

public class GraphCaseOperator extends SqlOperator {
Copy link
Collaborator

@longbinlai longbinlai Jun 21, 2023

Choose a reason for hiding this comment

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

It is CaseOperator instead of GraphCaseOperator, as it is not a Graph operator.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

public class CaseTest {
// case when a.name = 'marko' then 1 else 3 end
@Test
public void case_1_test() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add test of more than two branches

Copy link
Collaborator Author

@shirly121 shirly121 Jun 26, 2023

Choose a reason for hiding this comment

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

more cases are added in interactive_engine/compiler/src/test/java/com/alibaba/graphscope/cypher/antlr4/WithTest.java

@@ -124,6 +124,15 @@ message DynamicParam {
common.IrDataType data_type = 3;
}

message Case {
Copy link
Collaborator

Choose a reason for hiding this comment

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

message Case {
  // Pair of when <expr> then <expr>
  message WhenThen {
    Expression when = 1;
    Expression then = 2;
  }
  // A case operator always follows with a sequence of when_then pairs, e.g.
  // CASE WHEN a.name == 'Marko' THEN 1
  //          WHEN a.name == 'John' THEN 2
  repeated WhenThen when_thens = 1;
  // The trailed else expression:  ELSE 3
  Expression else_result = 2;
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link
Collaborator

@zhanglei1949 zhanglei1949 left a comment

Choose a reason for hiding this comment

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

LGTM

@longbinlai longbinlai merged commit 7fc14b5 into alibaba:main Jul 3, 2023
25 checks passed
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.

None yet

5 participants