[GitHub] [hive] vineetgarg02 commented on a change in pull request #557: HIVE-21338 Remove order by and limit for aggregates

2019-03-11 Thread GitBox
vineetgarg02 commented on a change in pull request #557: HIVE-21338 Remove 
order by and limit for aggregates
URL: https://github.com/apache/hive/pull/557#discussion_r264425844
 
 

 ##
 File path: ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
 ##
 @@ -1925,6 +1926,11 @@ public RelNode apply(RelOptCluster cluster, 
RelOptSchema relOptSchema, SchemaPlu
 perfLogger.PerfLogEnd(this.getClass().getName(), PerfLogger.OPTIMIZER, 
"Calcite: Window fixing rule");
   }
 
+  perfLogger.PerfLogBegin(this.getClass().getName(), PerfLogger.OPTIMIZER);
 
 Review comment:
   @jcamachor I have moved the rule to `applyPreJoinOrderingTransforms`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hive] vineetgarg02 commented on a change in pull request #557: HIVE-21338 Remove order by and limit for aggregates

2019-03-05 Thread GitBox
vineetgarg02 commented on a change in pull request #557: HIVE-21338 Remove 
order by and limit for aggregates
URL: https://github.com/apache/hive/pull/557#discussion_r262792425
 
 

 ##
 File path: ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
 ##
 @@ -1925,6 +1926,11 @@ public RelNode apply(RelOptCluster cluster, 
RelOptSchema relOptSchema, SchemaPlu
 perfLogger.PerfLogEnd(this.getClass().getName(), PerfLogger.OPTIMIZER, 
"Calcite: Window fixing rule");
   }
 
+  perfLogger.PerfLogBegin(this.getClass().getName(), PerfLogger.OPTIMIZER);
 
 Review comment:
   @jcamachor I am not sure if I understand the point fully.  In your example 
ORDER BY is already being removed. Are you suggesting to open JIRA to remove 
extra aggregate? 


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hive] vineetgarg02 commented on a change in pull request #557: HIVE-21338 Remove order by and limit for aggregates

2019-03-05 Thread GitBox
vineetgarg02 commented on a change in pull request #557: HIVE-21338 Remove 
order by and limit for aggregates
URL: https://github.com/apache/hive/pull/557#discussion_r262789953
 
 

 ##
 File path: 
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveSortLimitRemoveRule.java
 ##
 @@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.ql.optimizer.calcite.rules;
+
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelOptRuleOperand;
+import org.apache.hadoop.hive.ql.optimizer.calcite.HiveRelOptUtil;
+import org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveSortLimit;
+
+/**
+ * Planner rule that removes
+ * a {@link 
org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveSortLimit}.
+ * Note that this is different from HiveSortRemoveRule because this is not 
based on statistics
+ */
+public class HiveSortLimitRemoveRule extends RelOptRule {
+
+  //~ Constructors ---
+
+  public HiveSortLimitRemoveRule() {
+this(operand(HiveSortLimit.class, any()));
+  }
+
+  private HiveSortLimitRemoveRule(RelOptRuleOperand operand) {
+super(operand);
+  }
+
+  //~ Methods 
+
+  @Override
+  public boolean matches(RelOptRuleCall call) {
+final HiveSortLimit sortLimit = call.rel(0);
+
+return HiveRelOptUtil.produceAtmostOneRow(sortLimit.getInput());
 
 Review comment:
   @jcamachor The rule uses recursive method which could traverse the whole 
tree so restricting this rule to a specific pattern does not really make sense 
(beside matching HiveSortLimit). 


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:
us...@infra.apache.org


With regards,
Apache Git Services