You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/07/14 15:24:29 UTC

[GitHub] [ignite] gvvinblade commented on a change in pull request #7979: IGNITE-12620 Calcite integration. Index Nested Loop Join/Hash Join

gvvinblade commented on a change in pull request #7979:
URL: https://github.com/apache/ignite/pull/7979#discussion_r454440511



##########
File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rule/logical/LogicalOrToUnionRule.java
##########
@@ -86,22 +83,14 @@ private LogicalOrToUnionRule(Class<LogicalFilter> clazz, String desc) {
      * @return UnionAll expression.
      */
     private RelNode createUnionAll(RelOptCluster cluster, RelNode input, RexNode op1, RexNode op2) {
-        final RelBuilder builder = relBuilderFactory.create(cluster, null);
-        final RexBuilder rexBuilder = cluster.getRexBuilder();
+        RelBuilder relBldr = relBuilderFactory.create(cluster, null);
 
-        builder.push(input).filter(op1);
-        builder.push(input).filter(
-            builder.and(op2,
-                // LNNVL is used here. We must treat 'null' values as valid.
-                rexBuilder.makeCall(op1.getType(), SqlStdOperatorTable.CASE,
-                    ImmutableList.of(
-                        rexBuilder.makeCall(SqlStdOperatorTable.IS_NOT_NULL, op1),
-                        RexUtil.not(op1),
-                        rexBuilder.makeLiteral(true))
-                )
-            )
-        );
-
-        return builder.union(true).build();
+        return relBldr
+            .push(input).filter(op1)
+            .push(input).filter(
+                relBldr.and(op2,
+                    relBldr.or(relBldr.isNull(op1), relBldr.not(op1))))

Review comment:
       The only reason is that OR can be simplified and reduced (unlike CASE) in case of statements like `name="One" OR name="Two"`, RexSimplifier will eliminate produced OR at all.  After such reduction a calculated cost will be much more reliable and a generated code will be simpler.




----------------------------------------------------------------
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