hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1633246 - in /hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer: ColumnPruner.java ColumnPrunerProcFactory.java
Date Mon, 20 Oct 2014 22:41:16 GMT
Author: hashutosh
Date: Mon Oct 20 22:41:15 2014
New Revision: 1633246

URL: http://svn.apache.org/r1633246
Log:
HIVE-8404 : ColumnPruner doesnt prune columns from limit operator (Ashutosh Chauhan via Sergey
Shelukhin)

Modified:
    hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ColumnPruner.java
    hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ColumnPrunerProcFactory.java

Modified: hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ColumnPruner.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ColumnPruner.java?rev=1633246&r1=1633245&r2=1633246&view=diff
==============================================================================
--- hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ColumnPruner.java
(original)
+++ hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ColumnPruner.java
Mon Oct 20 22:41:15 2014
@@ -29,6 +29,7 @@ import org.apache.hadoop.hive.ql.exec.Fi
 import org.apache.hadoop.hive.ql.exec.GroupByOperator;
 import org.apache.hadoop.hive.ql.exec.LateralViewForwardOperator;
 import org.apache.hadoop.hive.ql.exec.LateralViewJoinOperator;
+import org.apache.hadoop.hive.ql.exec.LimitOperator;
 import org.apache.hadoop.hive.ql.exec.MapJoinOperator;
 import org.apache.hadoop.hive.ql.exec.Operator;
 import org.apache.hadoop.hive.ql.exec.PTFOperator;
@@ -76,6 +77,7 @@ public class ColumnPruner implements Tra
    * @param pactx
    *          the current parse context
    */
+  @Override
   public ParseContext transform(ParseContext pactx) throws SemanticException {
     pGraphContext = pactx;
     opToParseCtxMap = pGraphContext.getOpParseCtx();
@@ -120,6 +122,9 @@ public class ColumnPruner implements Tra
     opRules.put(new RuleRegExp("R11",
         ScriptOperator.getOperatorName() + "%"),
         ColumnPrunerProcFactory.getScriptProc());
+    opRules.put(new RuleRegExp("R12",
+        LimitOperator.getOperatorName() + "%"),
+        ColumnPrunerProcFactory.getLimitProc());
     // The dispatcher fires the processor corresponding to the closest matching
     // rule and passes the context along
     Dispatcher disp = new DefaultRuleDispatcher(ColumnPrunerProcFactory

Modified: hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ColumnPrunerProcFactory.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ColumnPrunerProcFactory.java?rev=1633246&r1=1633245&r2=1633246&view=diff
==============================================================================
--- hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ColumnPrunerProcFactory.java
(original)
+++ hive/branches/branch-0.14/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ColumnPrunerProcFactory.java
Mon Oct 20 22:41:15 2014
@@ -38,6 +38,7 @@ import org.apache.hadoop.hive.ql.exec.Gr
 import org.apache.hadoop.hive.ql.exec.JoinOperator;
 import org.apache.hadoop.hive.ql.exec.LateralViewForwardOperator;
 import org.apache.hadoop.hive.ql.exec.LateralViewJoinOperator;
+import org.apache.hadoop.hive.ql.exec.LimitOperator;
 import org.apache.hadoop.hive.ql.exec.MapJoinOperator;
 import org.apache.hadoop.hive.ql.exec.Operator;
 import org.apache.hadoop.hive.ql.exec.OperatorFactory;
@@ -215,6 +216,24 @@ public final class ColumnPrunerProcFacto
     }
   }
 
+  public static class ColumnPrunerLimitProc extends ColumnPrunerDefaultProc {
+
+    @Override
+    public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx ctx,
+        Object... nodeOutputs) throws SemanticException {
+      super.process(nd, stack, ctx, nodeOutputs);
+      List<String> cols = ((ColumnPrunerProcCtx)ctx).getPrunedColLists().get(nd);
+      if (null != cols) {
+        pruneOperator(ctx, (LimitOperator) nd, cols);
+      }
+      return null;
+    }
+  }
+
+  public static ColumnPrunerLimitProc getLimitProc() {
+    return new ColumnPrunerLimitProc();
+  }
+
   public static ColumnPrunerScriptProc getScriptProc() {
     return new ColumnPrunerScriptProc();
   }



Mime
View raw message