You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by kr...@apache.org on 2022/02/17 12:26:19 UTC

[hive] branch master updated: HIVE-25884: Improve rule description for rules defined as subclasses (Alessandro Solimando reviewed by Zoltan Haindrich, Krisztian Kasa)

This is an automated email from the ASF dual-hosted git repository.

krisztiankasa pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new aafced6  HIVE-25884: Improve rule description for rules defined as subclasses (Alessandro Solimando reviewed by Zoltan Haindrich, Krisztian Kasa)
aafced6 is described below

commit aafced6cd2b1bf31bd74c563680e02fd54cd1e01
Author: Alessandro Solimando <al...@gmail.com>
AuthorDate: Thu Feb 17 13:25:36 2022 +0100

    HIVE-25884: Improve rule description for rules defined as subclasses (Alessandro Solimando reviewed by Zoltan Haindrich, Krisztian Kasa)
---
 .../calcite/rules/HiveFilterJoinRule.java          |  8 ++++----
 .../calcite/rules/HiveInBetweenExpandRule.java     |  9 +++++---
 .../rules/HivePointLookupOptimizerRule.java        | 13 +++++++-----
 .../rules/HiveRewriteToDataSketchesRules.java      | 24 ++++++++++++----------
 .../rules/jdbc/JDBCExpandExpressionsRule.java      | 10 ++++-----
 5 files changed, 36 insertions(+), 28 deletions(-)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveFilterJoinRule.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveFilterJoinRule.java
index 335130d..bf08c98 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveFilterJoinRule.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveFilterJoinRule.java
@@ -71,7 +71,7 @@ public abstract class HiveFilterJoinRule extends FilterJoinRule {
 
     super(
       (Config) RelRule.Config.EMPTY
-      .withDescription("FilterJoinRule:" + id)
+      .withDescription("HiveFilterJoinRule(" + id + ")")
       .withOperandSupplier(b0 ->
         b0.exactly(operand))
       .as(FilterJoinRule.Config.class)
@@ -108,7 +108,7 @@ public abstract class HiveFilterJoinRule extends FilterJoinRule {
   public static class HiveFilterJoinMergeRule extends HiveFilterJoinRule {
     public HiveFilterJoinMergeRule() {
       super(operand(Filter.class, operand(Join.class, any())),
-          null, true, HiveRelFactories.HIVE_BUILDER);
+          HiveFilterJoinMergeRule.class.getSimpleName(), true, HiveRelFactories.HIVE_BUILDER);
     }
 
     @Override
@@ -130,8 +130,8 @@ public abstract class HiveFilterJoinRule extends FilterJoinRule {
 
   public static class HiveFilterJoinTransposeRule extends HiveFilterJoinRule {
     public HiveFilterJoinTransposeRule() {
-      super(RelOptRule.operand(Join.class, RelOptRule.any()), "HiveFilterJoinRule:no-filter", true,
-          HiveRelFactories.HIVE_BUILDER);
+      super(RelOptRule.operand(Join.class, RelOptRule.any()),
+          HiveFilterJoinTransposeRule.class.getSimpleName(), true, HiveRelFactories.HIVE_BUILDER);
     }
 
     @Override
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveInBetweenExpandRule.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveInBetweenExpandRule.java
index 0e1c65f..49b67f1 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveInBetweenExpandRule.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveInBetweenExpandRule.java
@@ -49,7 +49,8 @@ public class HiveInBetweenExpandRule {
   private static class FilterRule extends RelOptRule {
 
     FilterRule() {
-      super(operand(Filter.class, any()), HiveRelFactories.HIVE_BUILDER, null);
+      super(operand(Filter.class, any()), HiveRelFactories.HIVE_BUILDER,
+          "HiveInBetweenExpandRule(FilterRule)");
     }
 
     @Override
@@ -74,7 +75,8 @@ public class HiveInBetweenExpandRule {
   private static class JoinRule extends RelOptRule {
 
     JoinRule() {
-      super(operand(Join.class, any()), HiveRelFactories.HIVE_BUILDER, null);
+      super(operand(Join.class, any()), HiveRelFactories.HIVE_BUILDER,
+          "HiveInBetweenExpandRule(JoinRule)");
     }
 
     @Override
@@ -103,7 +105,8 @@ public class HiveInBetweenExpandRule {
   private static class ProjectRule extends RelOptRule {
 
     ProjectRule() {
-      super(operand(Project.class, any()), HiveRelFactories.HIVE_BUILDER, null);
+      super(operand(Project.class, any()), HiveRelFactories.HIVE_BUILDER,
+          "HiveInBetweenExpandRule(ProjectRule)");
     }
 
     @Override
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HivePointLookupOptimizerRule.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HivePointLookupOptimizerRule.java
index da6e9e7..a351a3d 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HivePointLookupOptimizerRule.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HivePointLookupOptimizerRule.java
@@ -81,7 +81,8 @@ public abstract class HivePointLookupOptimizerRule extends RelOptRule {
   /** Rule adapter to apply the transformation to Filter conditions. */
   public static class FilterCondition extends HivePointLookupOptimizerRule {
     public FilterCondition (int minNumORClauses) {
-      super(operand(Filter.class, any()), minNumORClauses);
+      super(operand(Filter.class, any()), minNumORClauses,
+          "HivePointLookupOptimizerRule(FilterCondition)");
     }
 
     @Override
@@ -105,7 +106,8 @@ public abstract class HivePointLookupOptimizerRule extends RelOptRule {
   /** Rule adapter to apply the transformation to Join conditions. */
   public static class JoinCondition extends HivePointLookupOptimizerRule {
     public JoinCondition (int minNumORClauses) {
-      super(operand(Join.class, any()), minNumORClauses);
+      super(operand(Join.class, any()), minNumORClauses,
+          "HivePointLookupOptimizerRule(JoinCondition)");
     }
 
     @Override
@@ -135,7 +137,8 @@ public abstract class HivePointLookupOptimizerRule extends RelOptRule {
   /** Rule adapter to apply the transformation to Projections. */
   public static class ProjectionExpressions extends HivePointLookupOptimizerRule {
     public ProjectionExpressions(int minNumORClauses) {
-      super(operand(Project.class, any()), minNumORClauses);
+      super(operand(Project.class, any()), minNumORClauses,
+          "HivePointLookupOptimizerRule(ProjectionExpressions)");
     }
 
     @Override
@@ -169,8 +172,8 @@ public abstract class HivePointLookupOptimizerRule extends RelOptRule {
   protected final int minNumORClauses;
 
   protected HivePointLookupOptimizerRule(
-    RelOptRuleOperand operand, int minNumORClauses) {
-    super(operand);
+      RelOptRuleOperand operand, int minNumORClauses, String description) {
+    super(operand, description);
     this.minNumORClauses = minNumORClauses;
   }
 
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRewriteToDataSketchesRules.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRewriteToDataSketchesRules.java
index 50df196..b86423c 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRewriteToDataSketchesRules.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRewriteToDataSketchesRules.java
@@ -98,8 +98,8 @@ public final class HiveRewriteToDataSketchesRules {
 
     private final ProjectFactory projectFactory;
 
-    public AggregateToProjectAggregateProject(RelOptRuleOperand operand) {
-      super(operand);
+    public AggregateToProjectAggregateProject(RelOptRuleOperand operand, String description) {
+      super(operand, description);
       projectFactory = HiveRelFactories.HIVE_PROJECT_FACTORY;
     }
 
@@ -230,7 +230,8 @@ public final class HiveRewriteToDataSketchesRules {
     private final String sketchType;
 
     public CountDistinctRewrite(String sketchType) {
-      super(operand(HiveAggregate.class, any()));
+      super(operand(HiveAggregate.class, any()),
+          "AggregateToProjectAggregateProject(CountDistinctRewrite)");
       this.sketchType = sketchType;
     }
 
@@ -305,7 +306,8 @@ public final class HiveRewriteToDataSketchesRules {
     private final String sketchType;
 
     public PercentileDiscRewrite(String sketchType) {
-      super(operand(HiveAggregate.class, operand(HiveProject.class, any())));
+      super(operand(HiveAggregate.class, operand(HiveProject.class, any())),
+          "AggregateToProjectAggregateProject(PercentileDiscRewrite)");
       this.sketchType = sketchType;
     }
 
@@ -397,8 +399,8 @@ public final class HiveRewriteToDataSketchesRules {
 
     protected final String sketchType;
 
-    public WindowingToProjectAggregateJoinProject(String sketchType) {
-      super(operand(HiveProject.class, any()), HiveRelFactories.HIVE_BUILDER, null);
+    public WindowingToProjectAggregateJoinProject(String sketchType, String description) {
+      super(operand(HiveProject.class, any()), HiveRelFactories.HIVE_BUILDER, description);
       this.sketchType = sketchType;
     }
 
@@ -505,8 +507,8 @@ public final class HiveRewriteToDataSketchesRules {
    */
   public static abstract class AbstractRankBasedRewriteRule extends WindowingToProjectAggregateJoinProject {
 
-    public AbstractRankBasedRewriteRule(String sketchType) {
-      super(sketchType);
+    public AbstractRankBasedRewriteRule(String sketchType, String description) {
+      super(sketchType, description);
     }
 
     protected static abstract class AbstractRankBasedRewriteBuilder extends VbuilderPAP {
@@ -617,7 +619,7 @@ public final class HiveRewriteToDataSketchesRules {
   public static class CumeDistRewriteRule extends AbstractRankBasedRewriteRule {
 
     public CumeDistRewriteRule(String sketchType) {
-      super(sketchType);
+      super(sketchType, "WindowingToProjectAggregateJoinProject(CumeDistRewriteRule)");
     }
 
     @Override
@@ -662,7 +664,7 @@ public final class HiveRewriteToDataSketchesRules {
   public static class NTileRewrite extends AbstractRankBasedRewriteRule {
 
     public NTileRewrite(String sketchType) {
-      super(sketchType);
+      super(sketchType, "WindowingToProjectAggregateJoinProject(NTileRewrite)");
     }
 
     @Override
@@ -718,7 +720,7 @@ public final class HiveRewriteToDataSketchesRules {
   public static class RankRewriteRule extends AbstractRankBasedRewriteRule {
 
     public RankRewriteRule(String sketchType) {
-      super(sketchType);
+      super(sketchType, "WindowingToProjectAggregateJoinProject(RankRewriteRule)");
     }
 
     @Override
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/jdbc/JDBCExpandExpressionsRule.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/jdbc/JDBCExpandExpressionsRule.java
index c903bba..5c42c61 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/jdbc/JDBCExpandExpressionsRule.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/jdbc/JDBCExpandExpressionsRule.java
@@ -56,15 +56,15 @@ public abstract class JDBCExpandExpressionsRule extends RelOptRule {
       new JDBCExpandExpressionsRule.ProjectionExpressions();
 
 
-  private JDBCExpandExpressionsRule(RelOptRuleOperand operand) {
-    super(operand);
+  private JDBCExpandExpressionsRule(RelOptRuleOperand operand, String description) {
+    super(operand, description);
   }
 
   /** Rule adapter to apply the transformation to Filter conditions. */
   private static class FilterCondition extends JDBCExpandExpressionsRule {
 
     private FilterCondition() {
-      super(operand(JdbcFilter.class, any()));
+      super(operand(JdbcFilter.class, any()), "JDBCExpandExpressionsRule(FilterCondition)");
     }
 
     @Override
@@ -91,7 +91,7 @@ public abstract class JDBCExpandExpressionsRule extends RelOptRule {
   private static class JoinCondition extends JDBCExpandExpressionsRule {
 
     private JoinCondition () {
-      super(operand(JdbcJoin.class, any()));
+      super(operand(JdbcJoin.class, any()), "JDBCExpandExpressionsRule(JoinCondition)");
     }
 
     @Override
@@ -124,7 +124,7 @@ public abstract class JDBCExpandExpressionsRule extends RelOptRule {
   private static class ProjectionExpressions extends JDBCExpandExpressionsRule {
 
     private ProjectionExpressions() {
-      super(operand(JdbcProject.class, any()));
+      super(operand(JdbcProject.class, any()), "JDBCExpandExpressionsRule(ProjectionExpressions)");
     }
 
     @Override