hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecapri...@apache.org
Subject svn commit: r1519306 - in /hive/trunk: common/src/java/org/apache/hadoop/hive/conf/ ql/src/java/org/apache/hadoop/hive/ql/exec/ ql/src/java/org/apache/hadoop/hive/ql/optimizer/ ql/src/java/org/apache/hadoop/hive/ql/parse/ ql/src/test/queries/clientposi...
Date Sun, 01 Sep 2013 19:29:24 GMT
Author: ecapriolo
Date: Sun Sep  1 19:29:23 2013
New Revision: 1519306

URL: http://svn.apache.org/r1519306
Log:
HIVE-4002 Fetch task aggregation for simple group by query (Navis Ryu and Yin Huai via egc)

Added:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/SimpleFetchAggregation.java
    hive/trunk/ql/src/test/queries/clientpositive/fetch_aggregation.q
    hive/trunk/ql/src/test/results/clientpositive/fetch_aggregation.q.out
Modified:
    hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchOperator.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/JoinOperator.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/PartitionKeySampler.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/UDTFOperator.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/Optimizer.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/SimpleFetchOptimizer.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/MapReduceCompiler.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseContext.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/RowResolver.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
    hive/trunk/ql/src/test/results/compiler/plan/groupby1.q.xml
    hive/trunk/ql/src/test/results/compiler/plan/groupby2.q.xml
    hive/trunk/ql/src/test/results/compiler/plan/groupby3.q.xml
    hive/trunk/ql/src/test/results/compiler/plan/groupby5.q.xml
    hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java

Modified: hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
URL: http://svn.apache.org/viewvc/hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java?rev=1519306&r1=1519305&r2=1519306&view=diff
==============================================================================
--- hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java (original)
+++ hive/trunk/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java Sun Sep  1 19:29:23 2013
@@ -661,6 +661,8 @@ public class HiveConf extends Configurat
     // 'minimal', 'more' (and 'all' later)
     HIVEFETCHTASKCONVERSION("hive.fetch.task.conversion", "minimal"),
 
+    HIVEFETCHTASKAGGR("hive.fetch.task.aggr", false),
+
     // Serde for FetchTask
     HIVEFETCHOUTPUTSERDE("hive.fetch.output.serde", "org.apache.hadoop.hive.serde2.DelimitedJSONSerDe"),
 

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchOperator.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchOperator.java?rev=1519306&r1=1519305&r2=1519306&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchOperator.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchOperator.java Sun Sep  1 19:29:23 2013
@@ -75,7 +75,7 @@ public class FetchOperator implements Se
 
   private boolean isNativeTable;
   private FetchWork work;
-  private Operator<?> operator;    // operator tree for processing row further (option)
+  protected Operator<?> operator;    // operator tree for processing row further (option)
   private int splitNum;
   private PartitionDesc currPart;
   private TableDesc currTbl;
@@ -489,6 +489,8 @@ public class FetchOperator implements Se
     InspectableObject row = getNextRow();
     if (row != null) {
       pushRow(row);
+    } else {
+      operator.flush();
     }
     return row != null;
   }

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java?rev=1519306&r1=1519305&r2=1519306&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/GroupByOperator.java Sun Sep  1 19:29:23 2013
@@ -60,7 +60,6 @@ import org.apache.hadoop.hive.serde2.obj
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils.ObjectInspectorCopyOption;
 import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory;
-import org.apache.hadoop.hive.serde2.objectinspector.StandardStructObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.StructField;
 import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.UnionObject;
@@ -164,7 +163,7 @@ public class GroupByOperator extends Ope
   transient int totalVariableSize;
   transient int numEntriesVarSize;
   transient int numEntriesHashTable;
-  transient int countAfterReport;
+  transient int countAfterReport;   // report or forward
   transient int heartbeatInterval;
 
   public static FastBitSet groupingSet2BitSet(int value) {
@@ -228,15 +227,15 @@ public class GroupByOperator extends Ope
     // reduce KEY has union field as the last field if there are distinct
     // aggregates in group-by.
     List<? extends StructField> sfs =
-      ((StandardStructObjectInspector) rowInspector).getAllStructFieldRefs();
+      ((StructObjectInspector) rowInspector).getAllStructFieldRefs();
     if (sfs.size() > 0) {
       StructField keyField = sfs.get(0);
       if (keyField.getFieldName().toUpperCase().equals(
           Utilities.ReduceField.KEY.name())) {
         ObjectInspector keyObjInspector = keyField.getFieldObjectInspector();
-        if (keyObjInspector instanceof StandardStructObjectInspector) {
+        if (keyObjInspector instanceof StructObjectInspector) {
           List<? extends StructField> keysfs =
-            ((StandardStructObjectInspector) keyObjInspector).getAllStructFieldRefs();
+            ((StructObjectInspector) keyObjInspector).getAllStructFieldRefs();
           if (keysfs.size() > 0) {
             // the last field is the union field, if any
             StructField sf = keysfs.get(keysfs.size() - 1);

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/JoinOperator.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/JoinOperator.java?rev=1519306&r1=1519305&r2=1519306&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/JoinOperator.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/JoinOperator.java Sun Sep  1 19:29:23 2013
@@ -32,7 +32,6 @@ import org.apache.hadoop.hive.ql.metadat
 import org.apache.hadoop.hive.ql.plan.JoinDesc;
 import org.apache.hadoop.hive.ql.plan.api.OperatorType;
 import org.apache.hadoop.hive.serde2.SerDeUtils;
-import org.apache.hadoop.hive.serde2.objectinspector.StandardStructObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.StructField;
 import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
 import org.apache.hadoop.io.LongWritable;
@@ -114,8 +113,8 @@ public class JoinOperator extends Common
 
       // Add the value to the vector
       // if join-key is null, process each row in different group.
-      StandardStructObjectInspector inspector =
-          (StandardStructObjectInspector) sf.getFieldObjectInspector();
+      StructObjectInspector inspector =
+          (StructObjectInspector) sf.getFieldObjectInspector();
       if (SerDeUtils.hasAnyNullObject(keyObject, inspector, nullsafes)) {
         endGroup();
         startGroup();

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/PartitionKeySampler.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/PartitionKeySampler.java?rev=1519306&r1=1519305&r2=1519306&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/PartitionKeySampler.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/PartitionKeySampler.java Sun Sep  1 19:29:23 2013
@@ -20,6 +20,13 @@
 
 package org.apache.hadoop.hive.ql.exec;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Random;
+
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -36,13 +43,6 @@ import org.apache.hadoop.io.WritableComp
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.mapred.OutputCollector;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Random;
-
 public class PartitionKeySampler implements OutputCollector<HiveKey, Object> {
 
   public static final Comparator<byte[]> C = new Comparator<byte[]>() {
@@ -51,7 +51,7 @@ public class PartitionKeySampler impleme
     }
   };
 
-  private List<byte[]> sampled = new ArrayList<byte[]>();
+  private final List<byte[]> sampled = new ArrayList<byte[]>();
 
   public void addSampleFile(Path inputPath, JobConf job) throws IOException {
     FileSystem fs = inputPath.getFileSystem(job);
@@ -134,6 +134,8 @@ public class PartitionKeySampler impleme
     private float samplePercent = 0.1f;
     private final Random random = new Random();
 
+    private int sampled;
+
     public FetchSampler(FetchWork work, JobConf job, Operator<?> operator) {
       super(work, job, operator, null);
     }
@@ -148,12 +150,22 @@ public class PartitionKeySampler impleme
 
     @Override
     public boolean pushRow() throws IOException, HiveException {
-      InspectableObject row = getNextRow();
-      if (row != null && random.nextFloat() < samplePercent) {
-        sampleNum--;
-        pushRow(row);
+      if (!super.pushRow()) {
+        return false;
+      }
+      if (sampled < sampleNum) {
+        return true;
+      }
+      operator.flush();
+      return false;
+    }
+
+    @Override
+    protected void pushRow(InspectableObject row) throws HiveException {
+      if (random.nextFloat() < samplePercent) {
+        sampled++;
+        super.pushRow(row);
       }
-      return sampleNum > 0 && row != null;
     }
   }
 }

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/UDTFOperator.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/UDTFOperator.java?rev=1519306&r1=1519305&r2=1519306&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/UDTFOperator.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/UDTFOperator.java Sun Sep  1 19:29:23 2013
@@ -32,7 +32,6 @@ import org.apache.hadoop.hive.ql.plan.ap
 import org.apache.hadoop.hive.ql.udf.generic.GenericUDTF;
 import org.apache.hadoop.hive.ql.udf.generic.UDTFCollector;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
-import org.apache.hadoop.hive.serde2.objectinspector.StandardStructObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.StructField;
 import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
 
@@ -66,7 +65,7 @@ public class UDTFOperator extends Operat
 
     // Make an object inspector [] of the arguments to the UDTF
     List<? extends StructField> inputFields =
-        ((StandardStructObjectInspector) inputObjInspectors[0]).getAllStructFieldRefs();
+        ((StructObjectInspector) inputObjInspectors[0]).getAllStructFieldRefs();
 
     udtfInputOIs = new ObjectInspector[inputFields.size()];
     for (int i = 0; i < inputFields.size(); i++) {
@@ -104,7 +103,7 @@ public class UDTFOperator extends Operat
   @Override
   public void processOp(Object row, int tag) throws HiveException {
     // The UDTF expects arguments in an object[]
-    StandardStructObjectInspector soi = (StandardStructObjectInspector) inputObjInspectors[tag];
+    StructObjectInspector soi = (StructObjectInspector) inputObjInspectors[tag];
     List<? extends StructField> fields = soi.getAllStructFieldRefs();
 
     for (int i = 0; i < fields.size(); i++) {

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/Optimizer.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/Optimizer.java?rev=1519306&r1=1519305&r2=1519306&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/Optimizer.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/Optimizer.java Sun Sep  1 19:29:23 2013
@@ -114,6 +114,10 @@ public class Optimizer {
       transformations.add(new LimitPushdownOptimizer());
     }
     transformations.add(new SimpleFetchOptimizer());  // must be called last
+
+    if (HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVEFETCHTASKAGGR)) {
+      transformations.add(new SimpleFetchAggregation());
+    }
   }
 
   /**

Added: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/SimpleFetchAggregation.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/SimpleFetchAggregation.java?rev=1519306&view=auto
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/SimpleFetchAggregation.java (added)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/SimpleFetchAggregation.java Sun Sep  1 19:29:23 2013
@@ -0,0 +1,132 @@
+/**
+ * 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;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Stack;
+
+import org.apache.hadoop.hive.ql.exec.FileSinkOperator;
+import org.apache.hadoop.hive.ql.exec.GroupByOperator;
+import org.apache.hadoop.hive.ql.exec.Operator;
+import org.apache.hadoop.hive.ql.exec.OperatorFactory;
+import org.apache.hadoop.hive.ql.exec.ReduceSinkOperator;
+import org.apache.hadoop.hive.ql.exec.SelectOperator;
+import org.apache.hadoop.hive.ql.lib.DefaultGraphWalker;
+import org.apache.hadoop.hive.ql.lib.DefaultRuleDispatcher;
+import org.apache.hadoop.hive.ql.lib.Dispatcher;
+import org.apache.hadoop.hive.ql.lib.GraphWalker;
+import org.apache.hadoop.hive.ql.lib.Node;
+import org.apache.hadoop.hive.ql.lib.NodeProcessor;
+import org.apache.hadoop.hive.ql.lib.NodeProcessorCtx;
+import org.apache.hadoop.hive.ql.lib.Rule;
+import org.apache.hadoop.hive.ql.lib.RuleRegExp;
+import org.apache.hadoop.hive.ql.parse.ParseContext;
+import org.apache.hadoop.hive.ql.parse.SemanticException;
+import org.apache.hadoop.hive.ql.plan.AggregationDesc;
+import org.apache.hadoop.hive.ql.plan.ExprNodeDesc;
+import org.apache.hadoop.hive.ql.plan.ExprNodeDescUtils;
+import org.apache.hadoop.hive.ql.plan.FileSinkDesc;
+import org.apache.hadoop.hive.ql.plan.OperatorDesc;
+import org.apache.hadoop.hive.ql.plan.PlanUtils;
+import org.apache.hadoop.hive.ql.plan.TableDesc;
+
+// execute final aggregation stage for simple fetch query on fetch task
+public class SimpleFetchAggregation implements Transform {
+
+  @Override
+  public ParseContext transform(ParseContext pctx) throws SemanticException {
+    if (pctx.getFetchTask() != null || !pctx.getQB().getIsQuery() ||
+        pctx.getQB().isAnalyzeRewrite() || pctx.getQB().isCTAS() ||
+        pctx.getLoadFileWork().size() > 1 || !pctx.getLoadTableWork().isEmpty()) {
+      return pctx;
+    }
+    String GBY = GroupByOperator.getOperatorName() + "%";
+    String RS = ReduceSinkOperator.getOperatorName() + "%";
+    String SEL = SelectOperator.getOperatorName() + "%";
+    String FS = FileSinkOperator.getOperatorName() + "%";
+
+    Map<Rule, NodeProcessor> opRules = new LinkedHashMap<Rule, NodeProcessor>();
+    opRules.put(new RuleRegExp("R1", GBY + RS + GBY + SEL + FS), new SingleGBYProcessor(pctx));
+
+    Dispatcher disp = new DefaultRuleDispatcher(null, opRules, null);
+    GraphWalker ogw = new DefaultGraphWalker(disp);
+
+    ArrayList<Node> topNodes = new ArrayList<Node>();
+    topNodes.addAll(pctx.getTopOps().values());
+    ogw.startWalking(topNodes, null);
+    return pctx;
+  }
+
+  static class SingleGBYProcessor implements NodeProcessor {
+
+    private ParseContext pctx;
+
+    public SingleGBYProcessor(ParseContext pctx) {
+      this.pctx = pctx;
+    }
+
+    public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx procCtx,
+        Object... nodeOutputs) throws SemanticException {
+      FileSinkOperator FS = (FileSinkOperator) nd;
+      GroupByOperator cGBY = (GroupByOperator) stack.get(stack.size() - 3);
+      ReduceSinkOperator RS = (ReduceSinkOperator) stack.get(stack.size() - 4);
+      if (RS.getConf().getNumReducers() != 1 || !RS.getConf().getKeyCols().isEmpty()) {
+        return null;
+      }
+      GroupByOperator pGBY = (GroupByOperator) stack.get(stack.size() - 5);
+
+      String fileName = FS.getConf().getFinalDirName();
+      TableDesc tsDesc = createIntermediateFS(pGBY, fileName);
+
+      for (AggregationDesc aggregation : cGBY.getConf().getAggregators()) {
+        List<ExprNodeDesc> parameters = aggregation.getParameters();
+        aggregation.setParameters(ExprNodeDescUtils.backtrack(parameters, cGBY, pGBY));
+      }
+
+      pctx.setFetchTabledesc(tsDesc);
+      pctx.setFetchSource(cGBY);
+      pctx.setFetchSink(SimpleFetchOptimizer.replaceFSwithLS(FS, "NULL"));
+
+      RS.setParentOperators(null);
+      RS.setChildOperators(null);
+      cGBY.setParentOperators(null);
+      return null;
+    }
+
+    private TableDesc createIntermediateFS(Operator<?> parent, String fileName) {
+      TableDesc tsDesc = PlanUtils.getIntermediateFileTableDesc(PlanUtils
+          .getFieldSchemasFromRowSchema(parent.getSchema(), "temporarycol"));
+
+      // Create a file sink operator for this file name
+      FileSinkDesc desc = new FileSinkDesc(fileName, tsDesc, false);
+      FileSinkOperator newFS = (FileSinkOperator) OperatorFactory.get(desc, parent.getSchema());
+
+      newFS.setParentOperators(new ArrayList<Operator<? extends OperatorDesc>>());
+      newFS.getParentOperators().add(parent);
+
+      parent.getChildOperators().clear();
+      parent.getChildOperators().add(newFS);
+
+      return tsDesc;
+    }
+  }
+}

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/SimpleFetchOptimizer.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/SimpleFetchOptimizer.java?rev=1519306&r1=1519305&r2=1519306&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/SimpleFetchOptimizer.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/SimpleFetchOptimizer.java Sun Sep  1 19:29:23 2013
@@ -234,14 +234,19 @@ public class SimpleFetchOptimizer implem
     // rows forwarded will be received by ListSinkOperator, which is replacing FS
     private ListSinkOperator completed(ParseContext pctx, FetchWork work) {
       pctx.getSemanticInputs().addAll(inputs);
-      ListSinkOperator sink = new ListSinkOperator();
-      sink.setConf(new ListSinkDesc(work.getSerializationNullFormat()));
-      sink.setParentOperators(new ArrayList<Operator<? extends OperatorDesc>>());
-      Operator<? extends OperatorDesc> parent = fileSink.getParentOperators().get(0);
-      sink.getParentOperators().add(parent);
-      parent.replaceChild(fileSink, sink);
-      fileSink.setParentOperators(null);
-      return sink;
+      return replaceFSwithLS(fileSink, work.getSerializationNullFormat());
     }
   }
+
+  public static ListSinkOperator replaceFSwithLS(Operator<?> fileSink, String nullFormat) {
+    ListSinkOperator sink = new ListSinkOperator();
+    sink.setConf(new ListSinkDesc(nullFormat));
+
+    sink.setParentOperators(new ArrayList<Operator<? extends OperatorDesc>>());
+    Operator<? extends OperatorDesc> parent = fileSink.getParentOperators().get(0);
+    sink.getParentOperators().add(parent);
+    parent.replaceChild(fileSink, sink);
+    fileSink.setParentOperators(null);
+    return sink;
+  }
 }

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/MapReduceCompiler.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/MapReduceCompiler.java?rev=1519306&r1=1519305&r2=1519306&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/MapReduceCompiler.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/MapReduceCompiler.java Sun Sep  1 19:29:23 2013
@@ -137,14 +137,22 @@ public class MapReduceCompiler {
       if ((!loadTableWork.isEmpty()) || (loadFileWork.size() != 1)) {
         throw new SemanticException(ErrorMsg.GENERIC_ERROR.getMsg());
       }
-      String cols = loadFileWork.get(0).getColumns();
-      String colTypes = loadFileWork.get(0).getColumnTypes();
 
-      String resFileFormat = HiveConf.getVar(conf, HiveConf.ConfVars.HIVEQUERYRESULTFILEFORMAT);
-      TableDesc resultTab = PlanUtils.getDefaultQueryOutputTableDesc(cols, colTypes, resFileFormat);
+      LoadFileDesc loadFileDesc = loadFileWork.get(0);
 
-      FetchWork fetch = new FetchWork(new Path(loadFileWork.get(0).getSourceDir()).toString(),
+      String cols = loadFileDesc.getColumns();
+      String colTypes = loadFileDesc.getColumnTypes();
+
+      TableDesc resultTab = pCtx.getFetchTabledesc();
+      if (resultTab == null) {
+        String resFileFormat = HiveConf.getVar(conf, HiveConf.ConfVars.HIVEQUERYRESULTFILEFORMAT);
+        resultTab = PlanUtils.getDefaultQueryOutputTableDesc(cols, colTypes, resFileFormat);
+      }
+
+      FetchWork fetch = new FetchWork(new Path(loadFileDesc.getSourceDir()).toString(),
           resultTab, qb.getParseInfo().getOuterQueryLimit());
+      fetch.setSource(pCtx.getFetchSource());
+      fetch.setSink(pCtx.getFetchSink());
 
       pCtx.setFetchTask((FetchTask) TaskFactory.get(fetch, conf));
 

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseContext.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseContext.java?rev=1519306&r1=1519305&r2=1519306&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseContext.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseContext.java Sun Sep  1 19:29:23 2013
@@ -34,6 +34,7 @@ import org.apache.hadoop.hive.ql.exec.Fe
 import org.apache.hadoop.hive.ql.exec.FileSinkOperator;
 import org.apache.hadoop.hive.ql.exec.GroupByOperator;
 import org.apache.hadoop.hive.ql.exec.JoinOperator;
+import org.apache.hadoop.hive.ql.exec.ListSinkOperator;
 import org.apache.hadoop.hive.ql.exec.MapJoinOperator;
 import org.apache.hadoop.hive.ql.exec.Operator;
 import org.apache.hadoop.hive.ql.exec.ReduceSinkOperator;
@@ -52,6 +53,7 @@ import org.apache.hadoop.hive.ql.plan.Lo
 import org.apache.hadoop.hive.ql.plan.LoadTableDesc;
 import org.apache.hadoop.hive.ql.plan.MapJoinDesc;
 import org.apache.hadoop.hive.ql.plan.OperatorDesc;
+import org.apache.hadoop.hive.ql.plan.TableDesc;
 
 /**
  * Parse Context: The current parse context. This is passed to the optimizer
@@ -108,6 +110,10 @@ public class ParseContext {
   private FetchTask fetchTask;
   private QueryProperties queryProperties;
 
+  private TableDesc fetchTabledesc;
+  private Operator<?> fetchSource;
+  private ListSinkOperator fetchSink;
+
   public ParseContext() {
   }
 
@@ -647,4 +653,28 @@ public class ParseContext {
   public void setQueryProperties(QueryProperties queryProperties) {
     this.queryProperties = queryProperties;
   }
+
+  public TableDesc getFetchTabledesc() {
+    return fetchTabledesc;
+  }
+
+  public void setFetchTabledesc(TableDesc fetchTabledesc) {
+    this.fetchTabledesc = fetchTabledesc;
+  }
+
+  public Operator<?> getFetchSource() {
+    return fetchSource;
+  }
+
+  public void setFetchSource(Operator<?> fetchSource) {
+    this.fetchSource = fetchSource;
+  }
+
+  public ListSinkOperator getFetchSink() {
+    return fetchSink;
+  }
+
+  public void setFetchSink(ListSinkOperator fetchSink) {
+    this.fetchSink = fetchSink;
+  }
 }

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/RowResolver.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/RowResolver.java?rev=1519306&r1=1519305&r2=1519306&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/RowResolver.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/RowResolver.java Sun Sep  1 19:29:23 2013
@@ -318,4 +318,18 @@ public class RowResolver implements Seri
     this.expressionMap = expressionMap;
   }
 
+  public String[] toColumnDesc() {
+    StringBuilder cols = new StringBuilder();
+    StringBuilder colTypes = new StringBuilder();
+
+    for (ColumnInfo colInfo : getColumnInfos()) {
+      if (cols.length() > 0) {
+        cols.append(',');
+        colTypes.append(':');
+      }
+      cols.append(colInfo.getInternalName());
+      colTypes.append(colInfo.getType().getTypeName());
+    }
+    return new String[] {cols.toString(), colTypes.toString()};
+  }
 }

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java?rev=1519306&r1=1519305&r2=1519306&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java Sun Sep  1 19:29:23 2013
@@ -3522,7 +3522,7 @@ public class SemanticAnalyzer extends Ba
 
     if (!mapAggrDone) {
       getReduceValuesForReduceSinkNoMapAgg(parseInfo, dest, reduceSinkInputRowResolver,
-          reduceSinkOutputRowResolver, outputValueColumnNames, reduceValues);
+          reduceSinkOutputRowResolver, outputValueColumnNames, reduceValues, colExprMap);
     } else {
       // Put partial aggregation results in reduceValues
       int inputField = reduceKeys.size();
@@ -3531,14 +3531,16 @@ public class SemanticAnalyzer extends Ba
 
         TypeInfo type = reduceSinkInputRowResolver.getColumnInfos().get(
             inputField).getType();
-        reduceValues.add(new ExprNodeColumnDesc(type,
-            getColumnInternalName(inputField), "", false));
+        ExprNodeColumnDesc exprDesc = new ExprNodeColumnDesc(type,
+            getColumnInternalName(inputField), "", false);
+        reduceValues.add(exprDesc);
         inputField++;
         outputValueColumnNames.add(getColumnInternalName(reduceValues.size() - 1));
         String field = Utilities.ReduceField.VALUE.toString() + "."
             + getColumnInternalName(reduceValues.size() - 1);
         reduceSinkOutputRowResolver.putExpression(entry.getValue(),
             new ColumnInfo(field, type, null, false));
+        colExprMap.put(field, exprDesc);
       }
     }
 
@@ -3626,8 +3628,8 @@ public class SemanticAnalyzer extends Ba
               + "." + name;
           ColumnInfo colInfo = new ColumnInfo(field, expr.getTypeInfo(), null, false);
           reduceSinkOutputRowResolver.putExpression(parameter, colInfo);
+          colExprMap.put(field, expr);
           numExprs++;
-          colExprMap.put(colInfo.getInternalName(), expr);
         }
         distinctColIndices.add(distinctIndices);
       }
@@ -3638,8 +3640,8 @@ public class SemanticAnalyzer extends Ba
 
   private void getReduceValuesForReduceSinkNoMapAgg(QBParseInfo parseInfo, String dest,
       RowResolver reduceSinkInputRowResolver, RowResolver reduceSinkOutputRowResolver,
-      List<String> outputValueColumnNames, ArrayList<ExprNodeDesc> reduceValues)
-      throws SemanticException {
+      List<String> outputValueColumnNames, ArrayList<ExprNodeDesc> reduceValues,
+      Map<String, ExprNodeDesc> colExprMap) throws SemanticException {
     HashMap<String, ASTNode> aggregationTrees = parseInfo
         .getAggregationExprsForClause(dest);
 
@@ -3650,8 +3652,8 @@ public class SemanticAnalyzer extends Ba
       for (int i = 1; i < value.getChildCount(); i++) {
         ASTNode parameter = (ASTNode) value.getChild(i);
         if (reduceSinkOutputRowResolver.getExpression(parameter) == null) {
-          reduceValues.add(genExprNodeDesc(parameter,
-              reduceSinkInputRowResolver));
+          ExprNodeDesc exprDesc = genExprNodeDesc(parameter, reduceSinkInputRowResolver);
+          reduceValues.add(exprDesc);
           outputValueColumnNames
               .add(getColumnInternalName(reduceValues.size() - 1));
           String field = Utilities.ReduceField.VALUE.toString() + "."
@@ -3659,6 +3661,7 @@ public class SemanticAnalyzer extends Ba
           reduceSinkOutputRowResolver.putExpression(parameter, new ColumnInfo(field,
               reduceValues.get(reduceValues.size() - 1).getTypeInfo(), null,
               false));
+          colExprMap.put(field, exprDesc);
         }
       }
     }
@@ -3699,7 +3702,7 @@ public class SemanticAnalyzer extends Ba
     for (String destination : dests) {
 
       getReduceValuesForReduceSinkNoMapAgg(parseInfo, destination, reduceSinkInputRowResolver,
-          reduceSinkOutputRowResolver, outputValueColumnNames, reduceValues);
+          reduceSinkOutputRowResolver, outputValueColumnNames, reduceValues, colExprMap);
 
       // Need to pass all of the columns used in the where clauses as reduce values
       ASTNode whereClause = parseInfo.getWhrForClause(destination);
@@ -3728,6 +3731,7 @@ public class SemanticAnalyzer extends Ba
           outputValueColumnNames.add(internalName);
           reduceSinkOutputRowResolver.putExpression(parameter,
               new ColumnInfo(field, expression.getTypeInfo(), null, false));
+          colExprMap.put(field, expression);
         }
       }
     }
@@ -3834,13 +3838,15 @@ public class SemanticAnalyzer extends Ba
       ASTNode t = entry.getValue();
       TypeInfo typeInfo = reduceSinkInputRowResolver2.getExpression(t)
           .getType();
-      reduceValues.add(new ExprNodeColumnDesc(typeInfo, field, "", false));
+      ExprNodeColumnDesc exprDesc = new ExprNodeColumnDesc(typeInfo, field, "", false);
+      reduceValues.add(exprDesc);
       inputField++;
       String col = getColumnInternalName(reduceValues.size() - 1);
       outputColumnNames.add(col);
       reduceSinkOutputRowResolver2.putExpression(t, new ColumnInfo(
           Utilities.ReduceField.VALUE.toString() + "." + col, typeInfo, "",
           false));
+      colExprMap.put(col, exprDesc);
     }
 
     ReduceSinkOperator rsOp = (ReduceSinkOperator) putOpInsertMap(
@@ -6975,7 +6981,7 @@ public class SemanticAnalyzer extends Ba
               reduceValues.size() - 1).getTypeInfo(), "", false);
           reduceSinkOutputRowResolver.putExpression(grpbyExpr, colInfo);
           outputColumnNames.add(getColumnInternalName(reduceValues.size() - 1));
-          colExprMap.put(colInfo.getInternalName(), grpByExprNode);
+          colExprMap.put(field, grpByExprNode);
         }
       }
 
@@ -7001,6 +7007,7 @@ public class SemanticAnalyzer extends Ba
             reduceSinkOutputRowResolver.putExpression(paraExpr, colInfo);
             outputColumnNames
                 .add(getColumnInternalName(reduceValues.size() - 1));
+            colExprMap.put(field, paraExprNode);
           }
         }
       }

Added: hive/trunk/ql/src/test/queries/clientpositive/fetch_aggregation.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/fetch_aggregation.q?rev=1519306&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/fetch_aggregation.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/fetch_aggregation.q Sun Sep  1 19:29:23 2013
@@ -0,0 +1,6 @@
+set hive.fetch.task.aggr=true;
+
+explain
+select count(key),sum(key),avg(key),min(key),max(key),std(key),variance(key) from src;
+
+select count(key),sum(key),avg(key),min(key),max(key),std(key),variance(key) from src;

Added: hive/trunk/ql/src/test/results/clientpositive/fetch_aggregation.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/fetch_aggregation.q.out?rev=1519306&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/fetch_aggregation.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/fetch_aggregation.q.out Sun Sep  1 19:29:23 2013
@@ -0,0 +1,89 @@
+PREHOOK: query: explain
+select count(key),sum(key),avg(key),min(key),max(key),std(key),variance(key) from src
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select count(key),sum(key),avg(key),min(key),max(key),std(key),variance(key) from src
+POSTHOOK: type: QUERY
+ABSTRACT SYNTAX TREE:
+  (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION count (TOK_TABLE_OR_COL key))) (TOK_SELEXPR (TOK_FUNCTION sum (TOK_TABLE_OR_COL key))) (TOK_SELEXPR (TOK_FUNCTION avg (TOK_TABLE_OR_COL key))) (TOK_SELEXPR (TOK_FUNCTION min (TOK_TABLE_OR_COL key))) (TOK_SELEXPR (TOK_FUNCTION max (TOK_TABLE_OR_COL key))) (TOK_SELEXPR (TOK_FUNCTION std (TOK_TABLE_OR_COL key))) (TOK_SELEXPR (TOK_FUNCTION variance (TOK_TABLE_OR_COL key))))))
+
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 is a root stage
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Alias -> Map Operator Tree:
+        src 
+          TableScan
+            alias: src
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+              outputColumnNames: key
+              Group By Operator
+                aggregations:
+                      expr: count(key)
+                      expr: sum(key)
+                      expr: avg(key)
+                      expr: min(key)
+                      expr: max(key)
+                      expr: std(key)
+                      expr: variance(key)
+                bucketGroup: false
+                mode: hash
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                File Output Operator
+                  compressed: false
+                  GlobalTableId: 0
+                  table:
+                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        Group By Operator
+          aggregations:
+                expr: count(_col0)
+                expr: sum(_col1)
+                expr: avg(_col2)
+                expr: min(_col3)
+                expr: max(_col4)
+                expr: std(_col5)
+                expr: variance(_col6)
+          bucketGroup: false
+          mode: mergepartial
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+          Select Operator
+            expressions:
+                  expr: _col0
+                  type: bigint
+                  expr: _col1
+                  type: double
+                  expr: _col2
+                  type: double
+                  expr: _col3
+                  type: string
+                  expr: _col4
+                  type: string
+                  expr: _col5
+                  type: double
+                  expr: _col6
+                  type: double
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+            ListSink
+
+
+PREHOOK: query: select count(key),sum(key),avg(key),min(key),max(key),std(key),variance(key) from src
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: select count(key),sum(key),avg(key),min(key),max(key),std(key),variance(key) from src
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+500	130091.0	260.182	0	98	142.92680950752384	20428.072876000006

Modified: hive/trunk/ql/src/test/results/compiler/plan/groupby1.q.xml
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/compiler/plan/groupby1.q.xml?rev=1519306&r1=1519305&r2=1519306&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/compiler/plan/groupby1.q.xml (original)
+++ hive/trunk/ql/src/test/results/compiler/plan/groupby1.q.xml Sun Sep  1 19:29:23 2013
@@ -349,6 +349,24 @@
                         </void> 
                        </object> 
                       </void> 
+                      <void method="put"> 
+                       <string>VALUE._col0</string> 
+                       <object id="ExprNodeColumnDesc1" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+                        <void property="column"> 
+                         <string>_col1</string> 
+                        </void> 
+                        <void property="tabAlias"> 
+                         <string></string> 
+                        </void> 
+                        <void property="typeInfo"> 
+                         <object id="PrimitiveTypeInfo1" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> 
+                          <void property="typeName"> 
+                           <string>double</string> 
+                          </void> 
+                         </object> 
+                        </void> 
+                       </object> 
+                      </void> 
                      </object> 
                     </void> 
                     <void property="conf"> 
@@ -421,21 +439,7 @@
                       <void property="valueCols"> 
                        <object class="java.util.ArrayList"> 
                         <void method="add"> 
-                         <object class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
-                          <void property="column"> 
-                           <string>_col1</string> 
-                          </void> 
-                          <void property="tabAlias"> 
-                           <string></string> 
-                          </void> 
-                          <void property="typeInfo"> 
-                           <object id="PrimitiveTypeInfo1" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> 
-                            <void property="typeName"> 
-                             <string>double</string> 
-                            </void> 
-                           </object> 
-                          </void> 
-                         </object> 
+                         <object idref="ExprNodeColumnDesc1"/> 
                         </void> 
                        </object> 
                       </void> 
@@ -532,7 +536,7 @@
                  <object class="java.util.HashMap"> 
                   <void method="put"> 
                    <string>_col0</string> 
-                   <object id="ExprNodeColumnDesc1" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+                   <object id="ExprNodeColumnDesc2" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
                     <void property="column"> 
                      <string>key</string> 
                     </void> 
@@ -631,7 +635,7 @@
                   <void property="keys"> 
                    <object class="java.util.ArrayList"> 
                     <void method="add"> 
-                     <object idref="ExprNodeColumnDesc1"/> 
+                     <object idref="ExprNodeColumnDesc2"/> 
                     </void> 
                    </object> 
                   </void> 
@@ -1318,7 +1322,7 @@
              <object class="java.util.HashMap"> 
               <void method="put"> 
                <string>_col1</string> 
-               <object id="ExprNodeColumnDesc2" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+               <object id="ExprNodeColumnDesc3" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
                 <void property="column"> 
                  <string>_col1</string> 
                 </void> 
@@ -1332,7 +1336,7 @@
               </void> 
               <void method="put"> 
                <string>_col0</string> 
-               <object id="ExprNodeColumnDesc3" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+               <object id="ExprNodeColumnDesc4" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
                 <void property="column"> 
                  <string>_col0</string> 
                 </void> 
@@ -1351,10 +1355,10 @@
               <void property="colList"> 
                <object class="java.util.ArrayList"> 
                 <void method="add"> 
-                 <object idref="ExprNodeColumnDesc3"/> 
+                 <object idref="ExprNodeColumnDesc4"/> 
                 </void> 
                 <void method="add"> 
-                 <object idref="ExprNodeColumnDesc2"/> 
+                 <object idref="ExprNodeColumnDesc3"/> 
                 </void> 
                </object> 
               </void> 
@@ -1432,7 +1436,7 @@
          <object class="java.util.HashMap"> 
           <void method="put"> 
            <string>_col0</string> 
-           <object id="ExprNodeColumnDesc4" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+           <object id="ExprNodeColumnDesc5" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
             <void property="column"> 
              <string>KEY._col0</string> 
             </void> 
@@ -1484,7 +1488,7 @@
           <void property="keys"> 
            <object class="java.util.ArrayList"> 
             <void method="add"> 
-             <object idref="ExprNodeColumnDesc4"/> 
+             <object idref="ExprNodeColumnDesc5"/> 
             </void> 
            </object> 
           </void> 

Modified: hive/trunk/ql/src/test/results/compiler/plan/groupby2.q.xml
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/compiler/plan/groupby2.q.xml?rev=1519306&r1=1519305&r2=1519306&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/compiler/plan/groupby2.q.xml (original)
+++ hive/trunk/ql/src/test/results/compiler/plan/groupby2.q.xml Sun Sep  1 19:29:23 2013
@@ -197,9 +197,27 @@
                        </object> 
                       </void> 
                       <void method="put"> 
-                       <string>KEY._col1:0._col0</string> 
+                       <string>VALUE._col1</string> 
                        <object id="ExprNodeColumnDesc1" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
                         <void property="column"> 
+                         <string>_col3</string> 
+                        </void> 
+                        <void property="tabAlias"> 
+                         <string></string> 
+                        </void> 
+                        <void property="typeInfo"> 
+                         <object id="PrimitiveTypeInfo1" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> 
+                          <void property="typeName"> 
+                           <string>double</string> 
+                          </void> 
+                         </object> 
+                        </void> 
+                       </object> 
+                      </void> 
+                      <void method="put"> 
+                       <string>KEY._col1:0._col0</string> 
+                       <object id="ExprNodeColumnDesc2" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+                        <void property="column"> 
                          <string>_col1</string> 
                         </void> 
                         <void property="tabAlias"> 
@@ -210,6 +228,24 @@
                         </void> 
                        </object> 
                       </void> 
+                      <void method="put"> 
+                       <string>VALUE._col0</string> 
+                       <object id="ExprNodeColumnDesc3" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+                        <void property="column"> 
+                         <string>_col2</string> 
+                        </void> 
+                        <void property="tabAlias"> 
+                         <string></string> 
+                        </void> 
+                        <void property="typeInfo"> 
+                         <object id="PrimitiveTypeInfo2" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> 
+                          <void property="typeName"> 
+                           <string>bigint</string> 
+                          </void> 
+                         </object> 
+                        </void> 
+                       </object> 
+                      </void> 
                      </object> 
                     </void> 
                     <void property="conf"> 
@@ -231,7 +267,7 @@
                          <object idref="ExprNodeColumnDesc0"/> 
                         </void> 
                         <void method="add"> 
-                         <object idref="ExprNodeColumnDesc1"/> 
+                         <object idref="ExprNodeColumnDesc2"/> 
                         </void> 
                        </object> 
                       </void> 
@@ -303,38 +339,10 @@
                       <void property="valueCols"> 
                        <object class="java.util.ArrayList"> 
                         <void method="add"> 
-                         <object class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
-                          <void property="column"> 
-                           <string>_col2</string> 
-                          </void> 
-                          <void property="tabAlias"> 
-                           <string></string> 
-                          </void> 
-                          <void property="typeInfo"> 
-                           <object id="PrimitiveTypeInfo1" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> 
-                            <void property="typeName"> 
-                             <string>bigint</string> 
-                            </void> 
-                           </object> 
-                          </void> 
-                         </object> 
+                         <object idref="ExprNodeColumnDesc3"/> 
                         </void> 
                         <void method="add"> 
-                         <object class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
-                          <void property="column"> 
-                           <string>_col3</string> 
-                          </void> 
-                          <void property="tabAlias"> 
-                           <string></string> 
-                          </void> 
-                          <void property="typeInfo"> 
-                           <object id="PrimitiveTypeInfo2" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> 
-                            <void property="typeName"> 
-                             <string>double</string> 
-                            </void> 
-                           </object> 
-                          </void> 
-                         </object> 
+                         <object idref="ExprNodeColumnDesc1"/> 
                         </void> 
                        </object> 
                       </void> 
@@ -425,7 +433,7 @@
                            <string>VALUE._col0</string> 
                           </void> 
                           <void property="type"> 
-                           <object idref="PrimitiveTypeInfo1"/> 
+                           <object idref="PrimitiveTypeInfo2"/> 
                           </void> 
                          </object> 
                         </void> 
@@ -435,7 +443,7 @@
                            <string>VALUE._col1</string> 
                           </void> 
                           <void property="type"> 
-                           <object idref="PrimitiveTypeInfo2"/> 
+                           <object idref="PrimitiveTypeInfo1"/> 
                           </void> 
                          </object> 
                         </void> 
@@ -816,7 +824,7 @@
                        <string></string> 
                       </void> 
                       <void property="type"> 
-                       <object idref="PrimitiveTypeInfo1"/> 
+                       <object idref="PrimitiveTypeInfo2"/> 
                       </void> 
                      </object> 
                     </void> 
@@ -829,7 +837,7 @@
                        <string></string> 
                       </void> 
                       <void property="type"> 
-                       <object idref="PrimitiveTypeInfo2"/> 
+                       <object idref="PrimitiveTypeInfo1"/> 
                       </void> 
                      </object> 
                     </void> 
@@ -856,7 +864,7 @@
                  <string>src</string> 
                 </void> 
                 <void property="typeInfo"> 
-                 <object idref="PrimitiveTypeInfo1"/> 
+                 <object idref="PrimitiveTypeInfo2"/> 
                 </void> 
                </object> 
               </void> 
@@ -1089,7 +1097,7 @@
                <string>src</string> 
               </void> 
               <void property="type"> 
-               <object idref="PrimitiveTypeInfo1"/> 
+               <object idref="PrimitiveTypeInfo2"/> 
               </void> 
              </object> 
             </void> 
@@ -1430,7 +1438,7 @@
                        <string></string> 
                       </void> 
                       <void property="type"> 
-                       <object idref="PrimitiveTypeInfo1"/> 
+                       <object idref="PrimitiveTypeInfo2"/> 
                       </void> 
                      </object> 
                     </void> 
@@ -1484,7 +1492,7 @@
                      <string></string> 
                     </void> 
                     <void property="typeInfo"> 
-                     <object idref="PrimitiveTypeInfo2"/> 
+                     <object idref="PrimitiveTypeInfo1"/> 
                     </void> 
                    </object> 
                   </void> 
@@ -1510,7 +1518,7 @@
               </void> 
               <void method="put"> 
                <string>_col1</string> 
-               <object id="ExprNodeColumnDesc2" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+               <object id="ExprNodeColumnDesc4" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
                 <void property="column"> 
                  <string>_col1</string> 
                 </void> 
@@ -1518,13 +1526,13 @@
                  <string></string> 
                 </void> 
                 <void property="typeInfo"> 
-                 <object idref="PrimitiveTypeInfo1"/> 
+                 <object idref="PrimitiveTypeInfo2"/> 
                 </void> 
                </object> 
               </void> 
               <void method="put"> 
                <string>_col0</string> 
-               <object id="ExprNodeColumnDesc3" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+               <object id="ExprNodeColumnDesc5" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
                 <void property="column"> 
                  <string>_col0</string> 
                 </void> 
@@ -1543,10 +1551,10 @@
               <void property="colList"> 
                <object class="java.util.ArrayList"> 
                 <void method="add"> 
-                 <object idref="ExprNodeColumnDesc3"/> 
+                 <object idref="ExprNodeColumnDesc5"/> 
                 </void> 
                 <void method="add"> 
-                 <object idref="ExprNodeColumnDesc2"/> 
+                 <object idref="ExprNodeColumnDesc4"/> 
                 </void> 
                 <void method="add"> 
                  <object idref="ExprNodeGenericFuncDesc2"/> 
@@ -1620,7 +1628,7 @@
                    <string>_col1</string> 
                   </void> 
                   <void property="type"> 
-                   <object idref="PrimitiveTypeInfo1"/> 
+                   <object idref="PrimitiveTypeInfo2"/> 
                   </void> 
                  </object> 
                 </void> 
@@ -1649,7 +1657,7 @@
          <object class="java.util.HashMap"> 
           <void method="put"> 
            <string>_col0</string> 
-           <object id="ExprNodeColumnDesc4" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+           <object id="ExprNodeColumnDesc6" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
             <void property="column"> 
              <string>KEY._col0</string> 
             </void> 
@@ -1717,7 +1725,7 @@
                    <string>VALUE._col1</string> 
                   </void> 
                   <void property="typeInfo"> 
-                   <object idref="PrimitiveTypeInfo2"/> 
+                   <object idref="PrimitiveTypeInfo1"/> 
                   </void> 
                  </object> 
                 </void> 
@@ -1736,7 +1744,7 @@
           <void property="keys"> 
            <object class="java.util.ArrayList"> 
             <void method="add"> 
-             <object idref="ExprNodeColumnDesc4"/> 
+             <object idref="ExprNodeColumnDesc6"/> 
             </void> 
            </object> 
           </void> 
@@ -1821,7 +1829,7 @@
                <string></string> 
               </void> 
               <void property="type"> 
-               <object idref="PrimitiveTypeInfo1"/> 
+               <object idref="PrimitiveTypeInfo2"/> 
               </void> 
              </object> 
             </void> 
@@ -1834,7 +1842,7 @@
                <string></string> 
               </void> 
               <void property="type"> 
-               <object idref="PrimitiveTypeInfo2"/> 
+               <object idref="PrimitiveTypeInfo1"/> 
               </void> 
              </object> 
             </void> 

Modified: hive/trunk/ql/src/test/results/compiler/plan/groupby3.q.xml
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/compiler/plan/groupby3.q.xml?rev=1519306&r1=1519305&r2=1519306&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/compiler/plan/groupby3.q.xml (original)
+++ hive/trunk/ql/src/test/results/compiler/plan/groupby3.q.xml Sun Sep  1 19:29:23 2013
@@ -179,10 +179,10 @@
                     <void property="columnExprMap"> 
                      <object class="java.util.HashMap"> 
                       <void method="put"> 
-                       <string>KEY._col0:0._col0</string> 
+                       <string>VALUE._col4</string> 
                        <object id="ExprNodeColumnDesc0" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
                         <void property="column"> 
-                         <string>_col0</string> 
+                         <string>_col5</string> 
                         </void> 
                         <void property="tabAlias"> 
                          <string></string> 
@@ -196,6 +196,105 @@
                         </void> 
                        </object> 
                       </void> 
+                      <void method="put"> 
+                       <string>VALUE._col3</string> 
+                       <object id="ExprNodeColumnDesc1" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+                        <void property="column"> 
+                         <string>_col4</string> 
+                        </void> 
+                        <void property="tabAlias"> 
+                         <string></string> 
+                        </void> 
+                        <void property="typeInfo"> 
+                         <object idref="PrimitiveTypeInfo0"/> 
+                        </void> 
+                       </object> 
+                      </void> 
+                      <void method="put"> 
+                       <string>VALUE._col2</string> 
+                       <object id="ExprNodeColumnDesc2" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+                        <void property="column"> 
+                         <string>_col3</string> 
+                        </void> 
+                        <void property="tabAlias"> 
+                         <string></string> 
+                        </void> 
+                        <void property="typeInfo"> 
+                         <object id="StructTypeInfo0" class="org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo"> 
+                          <void property="allStructFieldNames"> 
+                           <object class="java.util.ArrayList"> 
+                            <void method="add"> 
+                             <string>count</string> 
+                            </void> 
+                            <void method="add"> 
+                             <string>sum</string> 
+                            </void> 
+                           </object> 
+                          </void> 
+                          <void property="allStructFieldTypeInfos"> 
+                           <object class="java.util.ArrayList"> 
+                            <void method="add"> 
+                             <object id="PrimitiveTypeInfo1" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> 
+                              <void property="typeName"> 
+                               <string>bigint</string> 
+                              </void> 
+                             </object> 
+                            </void> 
+                            <void method="add"> 
+                             <object id="PrimitiveTypeInfo2" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> 
+                              <void property="typeName"> 
+                               <string>double</string> 
+                              </void> 
+                             </object> 
+                            </void> 
+                           </object> 
+                          </void> 
+                         </object> 
+                        </void> 
+                       </object> 
+                      </void> 
+                      <void method="put"> 
+                       <string>VALUE._col1</string> 
+                       <object id="ExprNodeColumnDesc3" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+                        <void property="column"> 
+                         <string>_col2</string> 
+                        </void> 
+                        <void property="tabAlias"> 
+                         <string></string> 
+                        </void> 
+                        <void property="typeInfo"> 
+                         <object idref="StructTypeInfo0"/> 
+                        </void> 
+                       </object> 
+                      </void> 
+                      <void method="put"> 
+                       <string>VALUE._col0</string> 
+                       <object id="ExprNodeColumnDesc4" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+                        <void property="column"> 
+                         <string>_col1</string> 
+                        </void> 
+                        <void property="tabAlias"> 
+                         <string></string> 
+                        </void> 
+                        <void property="typeInfo"> 
+                         <object idref="PrimitiveTypeInfo2"/> 
+                        </void> 
+                       </object> 
+                      </void> 
+                      <void method="put"> 
+                       <string>KEY._col0:0._col0</string> 
+                       <object id="ExprNodeColumnDesc5" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+                        <void property="column"> 
+                         <string>_col0</string> 
+                        </void> 
+                        <void property="tabAlias"> 
+                         <string></string> 
+                        </void> 
+                        <void property="typeInfo"> 
+                         <object idref="PrimitiveTypeInfo0"/> 
+                        </void> 
+                       </object> 
+                      </void> 
                      </object> 
                     </void> 
                     <void property="conf"> 
@@ -214,7 +313,7 @@
                       <void property="keyCols"> 
                        <object class="java.util.ArrayList"> 
                         <void method="add"> 
-                         <object idref="ExprNodeColumnDesc0"/> 
+                         <object idref="ExprNodeColumnDesc5"/> 
                         </void> 
                        </object> 
                       </void> 
@@ -285,98 +384,19 @@
                       <void property="valueCols"> 
                        <object class="java.util.ArrayList"> 
                         <void method="add"> 
-                         <object class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
-                          <void property="column"> 
-                           <string>_col1</string> 
-                          </void> 
-                          <void property="tabAlias"> 
-                           <string></string> 
-                          </void> 
-                          <void property="typeInfo"> 
-                           <object id="PrimitiveTypeInfo1" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> 
-                            <void property="typeName"> 
-                             <string>double</string> 
-                            </void> 
-                           </object> 
-                          </void> 
-                         </object> 
+                         <object idref="ExprNodeColumnDesc4"/> 
                         </void> 
                         <void method="add"> 
-                         <object class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
-                          <void property="column"> 
-                           <string>_col2</string> 
-                          </void> 
-                          <void property="tabAlias"> 
-                           <string></string> 
-                          </void> 
-                          <void property="typeInfo"> 
-                           <object id="StructTypeInfo0" class="org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo"> 
-                            <void property="allStructFieldNames"> 
-                             <object class="java.util.ArrayList"> 
-                              <void method="add"> 
-                               <string>count</string> 
-                              </void> 
-                              <void method="add"> 
-                               <string>sum</string> 
-                              </void> 
-                             </object> 
-                            </void> 
-                            <void property="allStructFieldTypeInfos"> 
-                             <object class="java.util.ArrayList"> 
-                              <void method="add"> 
-                               <object id="PrimitiveTypeInfo2" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> 
-                                <void property="typeName"> 
-                                 <string>bigint</string> 
-                                </void> 
-                               </object> 
-                              </void> 
-                              <void method="add"> 
-                               <object idref="PrimitiveTypeInfo1"/> 
-                              </void> 
-                             </object> 
-                            </void> 
-                           </object> 
-                          </void> 
-                         </object> 
+                         <object idref="ExprNodeColumnDesc3"/> 
                         </void> 
                         <void method="add"> 
-                         <object class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
-                          <void property="column"> 
-                           <string>_col3</string> 
-                          </void> 
-                          <void property="tabAlias"> 
-                           <string></string> 
-                          </void> 
-                          <void property="typeInfo"> 
-                           <object idref="StructTypeInfo0"/> 
-                          </void> 
-                         </object> 
+                         <object idref="ExprNodeColumnDesc2"/> 
                         </void> 
                         <void method="add"> 
-                         <object class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
-                          <void property="column"> 
-                           <string>_col4</string> 
-                          </void> 
-                          <void property="tabAlias"> 
-                           <string></string> 
-                          </void> 
-                          <void property="typeInfo"> 
-                           <object idref="PrimitiveTypeInfo0"/> 
-                          </void> 
-                         </object> 
+                         <object idref="ExprNodeColumnDesc1"/> 
                         </void> 
                         <void method="add"> 
-                         <object class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
-                          <void property="column"> 
-                           <string>_col5</string> 
-                          </void> 
-                          <void property="tabAlias"> 
-                           <string></string> 
-                          </void> 
-                          <void property="typeInfo"> 
-                           <object idref="PrimitiveTypeInfo0"/> 
-                          </void> 
-                         </object> 
+                         <object idref="ExprNodeColumnDesc0"/> 
                         </void> 
                        </object> 
                       </void> 
@@ -457,7 +477,7 @@
                            <string>VALUE._col0</string> 
                           </void> 
                           <void property="type"> 
-                           <object idref="PrimitiveTypeInfo1"/> 
+                           <object idref="PrimitiveTypeInfo2"/> 
                           </void> 
                          </object> 
                         </void> 
@@ -999,7 +1019,7 @@
                        <string></string> 
                       </void> 
                       <void property="type"> 
-                       <object idref="PrimitiveTypeInfo1"/> 
+                       <object idref="PrimitiveTypeInfo2"/> 
                       </void> 
                      </object> 
                     </void> 
@@ -1078,7 +1098,7 @@
                  <string>src</string> 
                 </void> 
                 <void property="typeInfo"> 
-                 <object idref="PrimitiveTypeInfo2"/> 
+                 <object idref="PrimitiveTypeInfo1"/> 
                 </void> 
                </object> 
               </void> 
@@ -1286,7 +1306,7 @@
                <string>src</string> 
               </void> 
               <void property="type"> 
-               <object idref="PrimitiveTypeInfo2"/> 
+               <object idref="PrimitiveTypeInfo1"/> 
               </void> 
              </object> 
             </void> 
@@ -1614,7 +1634,7 @@
                        <string></string> 
                       </void> 
                       <void property="type"> 
-                       <object idref="PrimitiveTypeInfo1"/> 
+                       <object idref="PrimitiveTypeInfo2"/> 
                       </void> 
                      </object> 
                     </void> 
@@ -1627,7 +1647,7 @@
                        <string></string> 
                       </void> 
                       <void property="type"> 
-                       <object idref="PrimitiveTypeInfo1"/> 
+                       <object idref="PrimitiveTypeInfo2"/> 
                       </void> 
                      </object> 
                     </void> 
@@ -1640,7 +1660,7 @@
                        <string></string> 
                       </void> 
                       <void property="type"> 
-                       <object idref="PrimitiveTypeInfo1"/> 
+                       <object idref="PrimitiveTypeInfo2"/> 
                       </void> 
                      </object> 
                     </void> 
@@ -1682,7 +1702,7 @@
              <object class="java.util.HashMap"> 
               <void method="put"> 
                <string>_col4</string> 
-               <object id="ExprNodeColumnDesc1" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+               <object id="ExprNodeColumnDesc6" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
                 <void property="column"> 
                  <string>_col4</string> 
                 </void> 
@@ -1696,7 +1716,7 @@
               </void> 
               <void method="put"> 
                <string>_col3</string> 
-               <object id="ExprNodeColumnDesc2" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+               <object id="ExprNodeColumnDesc7" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
                 <void property="column"> 
                  <string>_col3</string> 
                 </void> 
@@ -1710,7 +1730,7 @@
               </void> 
               <void method="put"> 
                <string>_col2</string> 
-               <object id="ExprNodeColumnDesc3" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+               <object id="ExprNodeColumnDesc8" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
                 <void property="column"> 
                  <string>_col2</string> 
                 </void> 
@@ -1718,13 +1738,13 @@
                  <string></string> 
                 </void> 
                 <void property="typeInfo"> 
-                 <object idref="PrimitiveTypeInfo1"/> 
+                 <object idref="PrimitiveTypeInfo2"/> 
                 </void> 
                </object> 
               </void> 
               <void method="put"> 
                <string>_col1</string> 
-               <object id="ExprNodeColumnDesc4" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+               <object id="ExprNodeColumnDesc9" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
                 <void property="column"> 
                  <string>_col1</string> 
                 </void> 
@@ -1732,13 +1752,13 @@
                  <string></string> 
                 </void> 
                 <void property="typeInfo"> 
-                 <object idref="PrimitiveTypeInfo1"/> 
+                 <object idref="PrimitiveTypeInfo2"/> 
                 </void> 
                </object> 
               </void> 
               <void method="put"> 
                <string>_col0</string> 
-               <object id="ExprNodeColumnDesc5" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+               <object id="ExprNodeColumnDesc10" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
                 <void property="column"> 
                  <string>_col0</string> 
                 </void> 
@@ -1746,7 +1766,7 @@
                  <string></string> 
                 </void> 
                 <void property="typeInfo"> 
-                 <object idref="PrimitiveTypeInfo1"/> 
+                 <object idref="PrimitiveTypeInfo2"/> 
                 </void> 
                </object> 
               </void> 
@@ -1757,19 +1777,19 @@
               <void property="colList"> 
                <object class="java.util.ArrayList"> 
                 <void method="add"> 
-                 <object idref="ExprNodeColumnDesc5"/> 
+                 <object idref="ExprNodeColumnDesc10"/> 
                 </void> 
                 <void method="add"> 
-                 <object idref="ExprNodeColumnDesc4"/> 
+                 <object idref="ExprNodeColumnDesc9"/> 
                 </void> 
                 <void method="add"> 
-                 <object idref="ExprNodeColumnDesc3"/> 
+                 <object idref="ExprNodeColumnDesc8"/> 
                 </void> 
                 <void method="add"> 
-                 <object idref="ExprNodeColumnDesc2"/> 
+                 <object idref="ExprNodeColumnDesc7"/> 
                 </void> 
                 <void method="add"> 
-                 <object idref="ExprNodeColumnDesc1"/> 
+                 <object idref="ExprNodeColumnDesc6"/> 
                 </void> 
                </object> 
               </void> 
@@ -1833,7 +1853,7 @@
                    <string>_col0</string> 
                   </void> 
                   <void property="type"> 
-                   <object idref="PrimitiveTypeInfo1"/> 
+                   <object idref="PrimitiveTypeInfo2"/> 
                   </void> 
                  </object> 
                 </void> 
@@ -1846,7 +1866,7 @@
                    <string>_col1</string> 
                   </void> 
                   <void property="type"> 
-                   <object idref="PrimitiveTypeInfo1"/> 
+                   <object idref="PrimitiveTypeInfo2"/> 
                   </void> 
                  </object> 
                 </void> 
@@ -1859,7 +1879,7 @@
                    <string>_col2</string> 
                   </void> 
                   <void property="type"> 
-                   <object idref="PrimitiveTypeInfo1"/> 
+                   <object idref="PrimitiveTypeInfo2"/> 
                   </void> 
                  </object> 
                 </void> 
@@ -1925,7 +1945,7 @@
                    <string>VALUE._col0</string> 
                   </void> 
                   <void property="typeInfo"> 
-                   <object idref="PrimitiveTypeInfo1"/> 
+                   <object idref="PrimitiveTypeInfo2"/> 
                   </void> 
                  </object> 
                 </void> 
@@ -2131,7 +2151,7 @@
                <string></string> 
               </void> 
               <void property="type"> 
-               <object idref="PrimitiveTypeInfo1"/> 
+               <object idref="PrimitiveTypeInfo2"/> 
               </void> 
              </object> 
             </void> 
@@ -2144,7 +2164,7 @@
                <string></string> 
               </void> 
               <void property="type"> 
-               <object idref="PrimitiveTypeInfo1"/> 
+               <object idref="PrimitiveTypeInfo2"/> 
               </void> 
              </object> 
             </void> 
@@ -2157,7 +2177,7 @@
                <string></string> 
               </void> 
               <void property="type"> 
-               <object idref="PrimitiveTypeInfo1"/> 
+               <object idref="PrimitiveTypeInfo2"/> 
               </void> 
              </object> 
             </void> 

Modified: hive/trunk/ql/src/test/results/compiler/plan/groupby5.q.xml
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/compiler/plan/groupby5.q.xml?rev=1519306&r1=1519305&r2=1519306&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/compiler/plan/groupby5.q.xml (original)
+++ hive/trunk/ql/src/test/results/compiler/plan/groupby5.q.xml Sun Sep  1 19:29:23 2013
@@ -196,6 +196,24 @@
                         </void> 
                        </object> 
                       </void> 
+                      <void method="put"> 
+                       <string>VALUE._col0</string> 
+                       <object id="ExprNodeColumnDesc1" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+                        <void property="column"> 
+                         <string>_col1</string> 
+                        </void> 
+                        <void property="tabAlias"> 
+                         <string></string> 
+                        </void> 
+                        <void property="typeInfo"> 
+                         <object id="PrimitiveTypeInfo1" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> 
+                          <void property="typeName"> 
+                           <string>double</string> 
+                          </void> 
+                         </object> 
+                        </void> 
+                       </object> 
+                      </void> 
                      </object> 
                     </void> 
                     <void property="conf"> 
@@ -268,21 +286,7 @@
                       <void property="valueCols"> 
                        <object class="java.util.ArrayList"> 
                         <void method="add"> 
-                         <object class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
-                          <void property="column"> 
-                           <string>_col1</string> 
-                          </void> 
-                          <void property="tabAlias"> 
-                           <string></string> 
-                          </void> 
-                          <void property="typeInfo"> 
-                           <object id="PrimitiveTypeInfo1" class="org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo"> 
-                            <void property="typeName"> 
-                             <string>double</string> 
-                            </void> 
-                           </object> 
-                          </void> 
-                         </object> 
+                         <object idref="ExprNodeColumnDesc1"/> 
                         </void> 
                        </object> 
                       </void> 
@@ -379,7 +383,7 @@
                  <object class="java.util.HashMap"> 
                   <void method="put"> 
                    <string>_col0</string> 
-                   <object id="ExprNodeColumnDesc1" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+                   <object id="ExprNodeColumnDesc2" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
                     <void property="column"> 
                      <string>key</string> 
                     </void> 
@@ -478,7 +482,7 @@
                   <void property="keys"> 
                    <object class="java.util.ArrayList"> 
                     <void method="add"> 
-                     <object idref="ExprNodeColumnDesc1"/> 
+                     <object idref="ExprNodeColumnDesc2"/> 
                     </void> 
                    </object> 
                   </void> 
@@ -1181,7 +1185,7 @@
              <object class="java.util.HashMap"> 
               <void method="put"> 
                <string>_col1</string> 
-               <object id="ExprNodeColumnDesc2" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+               <object id="ExprNodeColumnDesc3" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
                 <void property="column"> 
                  <string>_col1</string> 
                 </void> 
@@ -1195,7 +1199,7 @@
               </void> 
               <void method="put"> 
                <string>_col0</string> 
-               <object id="ExprNodeColumnDesc3" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+               <object id="ExprNodeColumnDesc4" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
                 <void property="column"> 
                  <string>_col0</string> 
                 </void> 
@@ -1214,10 +1218,10 @@
               <void property="colList"> 
                <object class="java.util.ArrayList"> 
                 <void method="add"> 
-                 <object idref="ExprNodeColumnDesc3"/> 
+                 <object idref="ExprNodeColumnDesc4"/> 
                 </void> 
                 <void method="add"> 
-                 <object idref="ExprNodeColumnDesc2"/> 
+                 <object idref="ExprNodeColumnDesc3"/> 
                 </void> 
                </object> 
               </void> 
@@ -1301,7 +1305,7 @@
          <object class="java.util.HashMap"> 
           <void method="put"> 
            <string>_col0</string> 
-           <object id="ExprNodeColumnDesc4" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
+           <object id="ExprNodeColumnDesc5" class="org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc"> 
             <void property="column"> 
              <string>KEY._col0</string> 
             </void> 
@@ -1353,7 +1357,7 @@
           <void property="keys"> 
            <object class="java.util.ArrayList"> 
             <void method="add"> 
-             <object idref="ExprNodeColumnDesc4"/> 
+             <object idref="ExprNodeColumnDesc5"/> 
             </void> 
            </object> 
           </void> 

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java?rev=1519306&r1=1519305&r2=1519306&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java Sun Sep  1 19:29:23 2013
@@ -30,7 +30,6 @@ import org.apache.hadoop.hive.serde2.obj
 import org.apache.hadoop.hive.serde2.objectinspector.MapObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
-import org.apache.hadoop.hive.serde2.objectinspector.StandardStructObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.StructField;
 import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.UnionObjectInspector;
@@ -405,7 +404,7 @@ public final class SerDeUtils {
   /**
    * return false though element is null if nullsafe flag is true for that
    */
-  public static boolean hasAnyNullObject(List o, StandardStructObjectInspector loi,
+  public static boolean hasAnyNullObject(List o, StructObjectInspector loi,
       boolean[] nullSafes) {
     List<? extends StructField> fields = loi.getAllStructFieldRefs();
     for (int i = 0; i < o.size();i++) {



Mime
View raw message