Grokbase Groups Hive commits May 2016
FAQ
Repository: hive
Updated Branches:
   refs/heads/master b8e086f5e -> d8f3d33b0


HIVE-13722: Add flag to detect constants to CBO pull up rules (Jesus Camacho Rodriguez, reviewed by Ashutosh Chauhan)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/d8f3d33b
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/d8f3d33b
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/d8f3d33b

Branch: refs/heads/master
Commit: d8f3d33b0629b6db1dad85d23a5b7c49b43e1594
Parents: b8e086f
Author: Jesus Camacho Rodriguez <jcamacho@apache.org>
Authored: Wed May 11 15:28:14 2016 +0100
Committer: Jesus Camacho Rodriguez <jcamacho@apache.org>
Committed: Wed May 11 15:28:14 2016 +0100

----------------------------------------------------------------------
  .../calcite/rules/HiveSortLimitPullUpConstantsRule.java | 7 +++++++
  .../optimizer/calcite/rules/HiveUnionPullUpConstantsRule.java | 7 +++++++
  2 files changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/d8f3d33b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveSortLimitPullUpConstantsRule.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveSortLimitPullUpConstantsRule.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveSortLimitPullUpConstantsRule.java
index d14b0ba..3be9b0a 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveSortLimitPullUpConstantsRule.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveSortLimitPullUpConstantsRule.java
@@ -108,6 +108,7 @@ public class HiveSortLimitPullUpConstantsRule extends RelOptRule {
      }

      // Create expressions for Project operators before and after the Sort
+ boolean atLeastOneConstant = false;
      List<RelDataTypeField> fields = sort.getInput().getRowType().getFieldList();
      List<Pair<RexNode, String>> newChildExprs = new ArrayList<>();
      List<RexNode> topChildExprs = new ArrayList<>();
@@ -116,6 +117,7 @@ public class HiveSortLimitPullUpConstantsRule extends RelOptRule {
        RexNode expr = rexBuilder.makeInputRef(sort.getInput(), i);
        RelDataTypeField field = fields.get(i);
        if (constants.containsKey(expr)) {
+ atLeastOneConstant = true;
          topChildExprs.add(constants.get(expr));
          topChildExprsFields.add(field.getName());
        } else {
@@ -125,6 +127,11 @@ public class HiveSortLimitPullUpConstantsRule extends RelOptRule {
        }
      }

+ // No constants were found
+ if (!atLeastOneConstant) {
+ return;
+ }
+
      // Update field collations
      final Mappings.TargetMapping mapping =
              RelOptUtil.permutation(Pair.left(newChildExprs), sort.getInput().getRowType()).inverse();

http://git-wip-us.apache.org/repos/asf/hive/blob/d8f3d33b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveUnionPullUpConstantsRule.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveUnionPullUpConstantsRule.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveUnionPullUpConstantsRule.java
index 3155cb1..2552f87 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveUnionPullUpConstantsRule.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveUnionPullUpConstantsRule.java
@@ -96,6 +96,7 @@ public class HiveUnionPullUpConstantsRule extends RelOptRule {
      }

      // Create expressions for Project operators before and after the Union
+ boolean atLeastOneConstant = false;
      List<RelDataTypeField> fields = union.getRowType().getFieldList();
      List<Pair<RexNode, String>> newChildExprs = new ArrayList<>();
      List<RexNode> topChildExprs = new ArrayList<>();
@@ -104,6 +105,7 @@ public class HiveUnionPullUpConstantsRule extends RelOptRule {
        RexNode expr = rexBuilder.makeInputRef(union, i);
        RelDataTypeField field = fields.get(i);
        if (constants.containsKey(expr)) {
+ atLeastOneConstant = true;
          topChildExprs.add(constants.get(expr));
          topChildExprsFields.add(field.getName());
        } else {
@@ -113,6 +115,11 @@ public class HiveUnionPullUpConstantsRule extends RelOptRule {
        }
      }

+ // No constants were found
+ if (!atLeastOneConstant) {
+ return;
+ }
+
      // Update top Project positions
      final Mappings.TargetMapping mapping =
              RelOptUtil.permutation(Pair.left(newChildExprs), union.getInput(0).getRowType()).inverse();

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommits @
categorieshive, hadoop
postedMay 11, '16 at 3:47p
activeMay 11, '16 at 3:47p
posts1
users1
websitehive.apache.org

1 user in discussion

Jcamacho: 1 post

People

Translate

site design / logo © 2021 Grokbase