You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2020/12/16 09:27:36 UTC
[GitHub] [calcite] zinking opened a new pull request #2301: CALCITE-4434 fix cannot implement 'CASE row WHEN row...'
zinking opened a new pull request #2301:
URL: https://github.com/apache/calcite/pull/2301
rt
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [calcite] zinking commented on a change in pull request #2301: CALCITE-4434 fix cannot implement 'CASE row WHEN row...'
Posted by GitBox <gi...@apache.org>.
zinking commented on a change in pull request #2301:
URL: https://github.com/apache/calcite/pull/2301#discussion_r549050035
##########
File path: core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java
##########
@@ -860,6 +861,29 @@ public RexNode convertCall(
: operandTypeChecker.getConsistency();
final List<RexNode> exprs = convertOperands(cx, call, consistency);
RelDataType type = rexBuilder.deriveReturnType(op, exprs);
+
+ //generate relation for `=(Row1,Row2)`
+ if (op.kind == SqlKind.EQUALS) {
+ RexNode expr0 = RexUtil.removeCast(exprs.get(0));
+ RexNode expr1 = RexUtil.removeCast(exprs.get(1));
Review comment:
ROW operation naturally includes a Cast outside. so the example test already has it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [calcite] zinking commented on a change in pull request #2301: CALCITE-4434 fix cannot implement 'CASE row WHEN row...'
Posted by GitBox <gi...@apache.org>.
zinking commented on a change in pull request #2301:
URL: https://github.com/apache/calcite/pull/2301#discussion_r549050001
##########
File path: core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java
##########
@@ -860,6 +861,29 @@ public RexNode convertCall(
: operandTypeChecker.getConsistency();
final List<RexNode> exprs = convertOperands(cx, call, consistency);
RelDataType type = rexBuilder.deriveReturnType(op, exprs);
+
+ //generate relation for `=(Row1,Row2)`
+ if (op.kind == SqlKind.EQUALS) {
+ RexNode expr0 = RexUtil.removeCast(exprs.get(0));
+ RexNode expr1 = RexUtil.removeCast(exprs.get(1));
+ SqlKind expr0Kind = expr0.getKind();
+ SqlKind expr1Kind = expr1.getKind();
+ if (expr0Kind == SqlKind.ROW && expr1Kind == SqlKind.ROW) {
+ RexCall call0 = (RexCall) expr0;
+ RexCall call1 = (RexCall) expr1;
Review comment:
YES
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [calcite] amaliujia commented on a change in pull request #2301: CALCITE-4434 fix cannot implement 'CASE row WHEN row...'
Posted by GitBox <gi...@apache.org>.
amaliujia commented on a change in pull request #2301:
URL: https://github.com/apache/calcite/pull/2301#discussion_r548414703
##########
File path: core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java
##########
@@ -860,6 +861,29 @@ public RexNode convertCall(
: operandTypeChecker.getConsistency();
final List<RexNode> exprs = convertOperands(cx, call, consistency);
RelDataType type = rexBuilder.deriveReturnType(op, exprs);
+
+ //generate relation for `=(Row1,Row2)`
+ if (op.kind == SqlKind.EQUALS) {
+ RexNode expr0 = RexUtil.removeCast(exprs.get(0));
+ RexNode expr1 = RexUtil.removeCast(exprs.get(1));
Review comment:
If you have to remove cast, then better to add a test that include CAST to show the difference?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [calcite] julianhyde commented on pull request #2301: CALCITE-4434 fix cannot implement 'CASE row WHEN row...'
Posted by GitBox <gi...@apache.org>.
julianhyde commented on pull request #2301:
URL: https://github.com/apache/calcite/pull/2301#issuecomment-754878238
Although marked as merged, this commit was backed out, then superseded by PR #2309.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [calcite] amaliujia commented on a change in pull request #2301: CALCITE-4434 fix cannot implement 'CASE row WHEN row...'
Posted by GitBox <gi...@apache.org>.
amaliujia commented on a change in pull request #2301:
URL: https://github.com/apache/calcite/pull/2301#discussion_r548412436
##########
File path: core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java
##########
@@ -860,6 +861,29 @@ public RexNode convertCall(
: operandTypeChecker.getConsistency();
final List<RexNode> exprs = convertOperands(cx, call, consistency);
RelDataType type = rexBuilder.deriveReturnType(op, exprs);
+
+ //generate relation for `=(Row1,Row2)`
+ if (op.kind == SqlKind.EQUALS) {
+ RexNode expr0 = RexUtil.removeCast(exprs.get(0));
+ RexNode expr1 = RexUtil.removeCast(exprs.get(1));
+ SqlKind expr0Kind = expr0.getKind();
+ SqlKind expr1Kind = expr1.getKind();
+ if (expr0Kind == SqlKind.ROW && expr1Kind == SqlKind.ROW) {
+ RexCall call0 = (RexCall) expr0;
+ RexCall call1 = (RexCall) expr1;
Review comment:
Can you give an example for `CASE (deptno, job) WHEN (20, 'CLERK') THEN 1`, what is the `exprs.get(0)` and `exprs.get(1)`?
Is exprs.get(0) `(deptno, job` and exprs.get(1) `(20, 'CLERK')`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [calcite] amaliujia commented on a change in pull request #2301: CALCITE-4434 fix cannot implement 'CASE row WHEN row...'
Posted by GitBox <gi...@apache.org>.
amaliujia commented on a change in pull request #2301:
URL: https://github.com/apache/calcite/pull/2301#discussion_r548413547
##########
File path: core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java
##########
@@ -860,6 +861,29 @@ public RexNode convertCall(
: operandTypeChecker.getConsistency();
final List<RexNode> exprs = convertOperands(cx, call, consistency);
RelDataType type = rexBuilder.deriveReturnType(op, exprs);
+
+ //generate relation for `=(Row1,Row2)`
+ if (op.kind == SqlKind.EQUALS) {
+ RexNode expr0 = RexUtil.removeCast(exprs.get(0));
+ RexNode expr1 = RexUtil.removeCast(exprs.get(1));
Review comment:
Actually why need to remove cast?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [calcite] amaliujia merged pull request #2301: CALCITE-4434 fix cannot implement 'CASE row WHEN row...'
Posted by GitBox <gi...@apache.org>.
amaliujia merged pull request #2301:
URL: https://github.com/apache/calcite/pull/2301
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org