diff --git ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveReduceExpressionsRule.java ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveReduceExpressionsRule.java index 9006f45..2fe9b75 100644 --- ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveReduceExpressionsRule.java +++ ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveReduceExpressionsRule.java @@ -396,6 +396,131 @@ protected static void findReducibleExps(RelDataTypeFactory typeFactory, assert constExps.size() == addCasts.size(); } + /** Creates a map containing each (e, constant) pair that occurs within + * a predicate list. + * + * @param clazz Class of expression that is considered constant + * @param rexBuilder Rex builder + * @param predicates Predicate list + * @param what to consider a constant: {@link RexLiteral} to use a narrow + * definition of constant, or {@link RexNode} to use + * {@link RexUtil#isConstant(RexNode)} + * @return Map from values to constants + */ + public static ImmutableMap predicateConstants( + Class clazz, RexBuilder rexBuilder, RelOptPredicateList predicates) { + // We cannot use an ImmutableMap.Builder here. If there are multiple entries + // with the same key (e.g. "WHERE deptno = 1 AND deptno = 2"), it doesn't + // matter which we take, so the latter will replace the former. + // The basic idea is to find all the pairs of RexNode = RexLiteral + // (1) If 'predicates' contain a non-EQUALS, we bail out. + // (2) It is OK if a RexNode is equal to the same RexLiteral several times, + // (e.g. "WHERE deptno = 1 AND deptno = 1") + // (3) It will return false if there are inconsistent constraints (e.g. + // "WHERE deptno = 1 AND deptno = 2") + final Map map = new HashMap<>(); + final Set excludeSet = new HashSet<>(); + for (RexNode predicate : predicates.pulledUpPredicates) { + gatherConstraints(clazz, predicate, map, excludeSet, rexBuilder); + } + final ImmutableMap.Builder builder = + ImmutableMap.builder(); + for (Map.Entry entry : map.entrySet()) { + RexNode rexNode = entry.getKey(); + if (!overlap(rexNode, excludeSet)) { + builder.put(rexNode, entry.getValue()); + } + } + return builder.build(); + } + + private static void gatherConstraints(Class clazz, + RexNode predicate, Map map, Set excludeSet, + RexBuilder rexBuilder) { + if (predicate.getKind() != SqlKind.EQUALS) { + decompose(excludeSet, predicate); + return; + } + final List operands = ((RexCall) predicate).getOperands(); + if (operands.size() != 2) { + decompose(excludeSet, predicate); + return; + } + // if it reaches here, we have rexNode equals rexNode + final RexNode left = operands.get(0); + final RexNode right = operands.get(1); + // note that literals are immutable too and they can only be compared through + // values. + gatherConstraint(clazz, left, right, map, excludeSet, rexBuilder); + gatherConstraint(clazz, right, left, map, excludeSet, rexBuilder); + } + + /** Returns whether a value of {@code type2} can be assigned to a variable + * of {@code type1}. + * + *

For example: + *

    + *
  • {@code canAssignFrom(BIGINT, TINYINT)} returns {@code true}
  • + *
  • {@code canAssignFrom(TINYINT, BIGINT)} returns {@code false}
  • + *
  • {@code canAssignFrom(BIGINT, VARCHAR)} returns {@code false}
  • + *
+ */ + private static boolean canAssignFrom(RelDataType type1, RelDataType type2) { + final SqlTypeName name1 = type1.getSqlTypeName(); + final SqlTypeName name2 = type2.getSqlTypeName(); + if (name1.getFamily() == name2.getFamily()) { + switch (name1.getFamily()) { + case NUMERIC: + return name1.compareTo(name2) >= 0; + default: + return true; + } + } + return false; + } + + private static void gatherConstraint(Class clazz, + RexNode left, RexNode right, Map map, Set excludeSet, + RexBuilder rexBuilder) { + if (!clazz.isInstance(right)) { + return; + } + if (!RexUtil.isConstant(right)) { + return; + } + C constant = clazz.cast(right); + if (excludeSet.contains(left)) { + return; + } + final C existedValue = map.get(left); + if (existedValue == null) { + switch (left.getKind()) { + case CAST: + // Convert "CAST(c) = literal" to "c = literal", as long as it is a + // widening cast. + final RexNode operand = ((RexCall) left).getOperands().get(0); + if (canAssignFrom(left.getType(), operand.getType())) { + final RexNode castRight = + rexBuilder.makeCast(operand.getType(), constant); + if (castRight instanceof RexLiteral) { + left = operand; + constant = clazz.cast(castRight); + } + } + } + map.put(left, constant); + } else { + if (existedValue instanceof RexLiteral + && constant instanceof RexLiteral + && !((RexLiteral) existedValue).getValue() + .equals(((RexLiteral) constant).getValue())) { + // we found conflicting values, e.g. left = 10 and left = 20 + map.remove(left); + excludeSet.add(left); + } + } + } + protected static ImmutableMap predicateConstants( RelOptPredicateList predicates) { // We cannot use an ImmutableMap.Builder here. If there are multiple entries diff --git ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveUnionPullUpConstantsRule.java ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveUnionPullUpConstantsRule.java new file mode 100644 index 0000000..1a6c473 --- /dev/null +++ ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveUnionPullUpConstantsRule.java @@ -0,0 +1,133 @@ +/** + * 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 java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.calcite.plan.RelOptPredicateList; +import org.apache.calcite.plan.RelOptRule; +import org.apache.calcite.plan.RelOptRuleCall; +import org.apache.calcite.plan.RelOptUtil; +import org.apache.calcite.rel.core.Union; +import org.apache.calcite.rel.metadata.RelMetadataQuery; +import org.apache.calcite.rel.type.RelDataTypeField; +import org.apache.calcite.rex.RexBuilder; +import org.apache.calcite.rex.RexNode; +import org.apache.calcite.rex.RexUtil; +import org.apache.calcite.tools.RelBuilder; +import org.apache.calcite.tools.RelBuilderFactory; +import org.apache.calcite.util.Pair; +import org.apache.calcite.util.mapping.Mappings; +import org.apache.hadoop.hive.ql.optimizer.calcite.HiveRelFactories; +import org.apache.hadoop.hive.ql.optimizer.calcite.reloperators.HiveUnion; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.collect.ImmutableList; + +/** + * Planner rule that pulls up constant keys through a Union operator. + */ +public class HiveUnionPullUpConstantsRule extends RelOptRule { + + protected static final Logger LOG = LoggerFactory.getLogger(HiveUnionPullUpConstantsRule.class); + + + public static final HiveUnionPullUpConstantsRule INSTANCE = + new HiveUnionPullUpConstantsRule(HiveUnion.class, + HiveRelFactories.HIVE_BUILDER); + + private HiveUnionPullUpConstantsRule( + Class unionClass, + RelBuilderFactory relBuilderFactory) { + super(operand(unionClass, any()), + relBuilderFactory, null); + } + + @Override + public void onMatch(RelOptRuleCall call) { + final Union union = call.rel(0); + + final int count = union.getRowType().getFieldCount(); + if (count == 1) { + // No room for optimization since we cannot create an empty + // Project operator. + return; + } + + final RexBuilder rexBuilder = union.getCluster().getRexBuilder(); + final RelMetadataQuery mq = RelMetadataQuery.instance(); + final RelOptPredicateList predicates = mq.getPulledUpPredicates(union); + if (predicates == null) { + return; + } + + Map constants = HiveReduceExpressionsRule.predicateConstants( + RexNode.class, rexBuilder, predicates); + + // None of the expressions are constant. Nothing to do. + if (constants.isEmpty()) { + return; + } + + if (count == constants.size()) { + // At least a single item in project is required. + final Map map = new HashMap<>(constants); + map.remove(map.keySet().iterator().next()); + constants = map; + } + + // Create expressions for Project operators before and after the Union + List fields = union.getRowType().getFieldList(); + List> newChildExprs = new ArrayList<>(); + List topChildExprs = new ArrayList<>(); + List topChildExprsFields = new ArrayList<>(); + for (int i = 0; i < count ; i++) { + RexNode expr = rexBuilder.makeInputRef(union, i); + RelDataTypeField field = fields.get(i); + if (constants.containsKey(expr)) { + topChildExprs.add(constants.get(expr)); + topChildExprsFields.add(field.getName()); + } else { + newChildExprs.add(Pair.of(expr, field.getName())); + topChildExprs.add(expr); + topChildExprsFields.add(field.getName()); + } + } + + // Update top Project positions + final Mappings.TargetMapping mapping = + RelOptUtil.permutation(Pair.left(newChildExprs), union.getInput(0).getRowType()).inverse(); + topChildExprs = ImmutableList.copyOf(RexUtil.apply(mapping, topChildExprs)); + + // Create new Project-Union-Project sequences + final RelBuilder relBuilder = call.builder(); + for (int i = 0; i < union.getInputs().size() ; i++) { + relBuilder.push(union.getInput(i)); + relBuilder.project(Pair.left(newChildExprs), Pair.right(newChildExprs)); + } + relBuilder.union(union.all, union.getInputs().size()); + relBuilder.project(topChildExprs, topChildExprsFields); + + call.transformTo(relBuilder.build()); + } + +} diff --git ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java index 8e00e0b..a53757a 100644 --- ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java +++ ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java @@ -153,6 +153,7 @@ import org.apache.hadoop.hive.ql.optimizer.calcite.rules.HiveJoinProjectTransposeRule; import org.apache.hadoop.hive.ql.optimizer.calcite.rules.HiveJoinPushTransitivePredicatesRule; import org.apache.hadoop.hive.ql.optimizer.calcite.rules.HiveJoinToMultiJoinRule; +import org.apache.hadoop.hive.ql.optimizer.calcite.rules.HiveUnionPullUpConstantsRule; import org.apache.hadoop.hive.ql.optimizer.calcite.rules.HivePartitionPruneRule; import org.apache.hadoop.hive.ql.optimizer.calcite.rules.HivePointLookupOptimizerRule; import org.apache.hadoop.hive.ql.optimizer.calcite.rules.HivePreFilteringRule; @@ -1163,6 +1164,7 @@ private RelNode applyPreJoinOrderingTransforms(RelNode basePlan, RelMetadataProv rules.add(HiveJoinAddNotNullRule.INSTANCE_SEMIJOIN); rules.add(HiveJoinPushTransitivePredicatesRule.INSTANCE_JOIN); rules.add(HiveJoinPushTransitivePredicatesRule.INSTANCE_SEMIJOIN); + rules.add(HiveUnionPullUpConstantsRule.INSTANCE); perfLogger.PerfLogBegin(this.getClass().getName(), PerfLogger.OPTIMIZER); basePlan = hepPlan(basePlan, true, mdProvider, executorProvider, HepMatchOrder.BOTTOM_UP, rules.toArray(new RelOptRule[rules.size()])); diff --git ql/src/test/queries/clientpositive/cbo_union_view.q ql/src/test/queries/clientpositive/cbo_union_view.q new file mode 100644 index 0000000..d889b1d --- /dev/null +++ ql/src/test/queries/clientpositive/cbo_union_view.q @@ -0,0 +1,19 @@ +set hive.mapred.mode=nonstrict; +set hive.optimize.constant.propagation=false; + +CREATE TABLE src_union_1 (key int, value string) PARTITIONED BY (ds string); +CREATE TABLE src_union_2 (key int, value string) PARTITIONED BY (ds string, part_1 string); +CREATE TABLE src_union_3 (key int, value string) PARTITIONED BY (ds string, part_1 string, part_2 string); + +CREATE VIEW src_union_view PARTITIONED ON (ds) as +SELECT key, value, ds FROM ( +SELECT key, value, ds FROM src_union_1 +UNION ALL +SELECT key, value, ds FROM src_union_2 +UNION ALL +SELECT key, value, ds FROM src_union_3 +) subq; + +EXPLAIN SELECT key, value, ds FROM src_union_view WHERE key=86; + +EXPLAIN SELECT key, value, ds FROM src_union_view WHERE key=86 AND ds ='1'; diff --git ql/src/test/results/clientpositive/cbo_union_view.q.out ql/src/test/results/clientpositive/cbo_union_view.q.out new file mode 100644 index 0000000..ed6bba9 --- /dev/null +++ ql/src/test/results/clientpositive/cbo_union_view.q.out @@ -0,0 +1,228 @@ +PREHOOK: query: CREATE TABLE src_union_1 (key int, value string) PARTITIONED BY (ds string) +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@src_union_1 +POSTHOOK: query: CREATE TABLE src_union_1 (key int, value string) PARTITIONED BY (ds string) +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@src_union_1 +PREHOOK: query: CREATE TABLE src_union_2 (key int, value string) PARTITIONED BY (ds string, part_1 string) +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@src_union_2 +POSTHOOK: query: CREATE TABLE src_union_2 (key int, value string) PARTITIONED BY (ds string, part_1 string) +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@src_union_2 +PREHOOK: query: CREATE TABLE src_union_3 (key int, value string) PARTITIONED BY (ds string, part_1 string, part_2 string) +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@src_union_3 +POSTHOOK: query: CREATE TABLE src_union_3 (key int, value string) PARTITIONED BY (ds string, part_1 string, part_2 string) +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@src_union_3 +PREHOOK: query: CREATE VIEW src_union_view PARTITIONED ON (ds) as +SELECT key, value, ds FROM ( +SELECT key, value, ds FROM src_union_1 +UNION ALL +SELECT key, value, ds FROM src_union_2 +UNION ALL +SELECT key, value, ds FROM src_union_3 +) subq +PREHOOK: type: CREATEVIEW +PREHOOK: Input: default@src_union_1 +PREHOOK: Input: default@src_union_2 +PREHOOK: Input: default@src_union_3 +PREHOOK: Output: database:default +PREHOOK: Output: default@src_union_view +POSTHOOK: query: CREATE VIEW src_union_view PARTITIONED ON (ds) as +SELECT key, value, ds FROM ( +SELECT key, value, ds FROM src_union_1 +UNION ALL +SELECT key, value, ds FROM src_union_2 +UNION ALL +SELECT key, value, ds FROM src_union_3 +) subq +POSTHOOK: type: CREATEVIEW +POSTHOOK: Input: default@src_union_1 +POSTHOOK: Input: default@src_union_2 +POSTHOOK: Input: default@src_union_3 +POSTHOOK: Output: database:default +POSTHOOK: Output: default@src_union_view +PREHOOK: query: EXPLAIN SELECT key, value, ds FROM src_union_view WHERE key=86 +PREHOOK: type: QUERY +POSTHOOK: query: EXPLAIN SELECT key, value, ds FROM src_union_view WHERE key=86 +POSTHOOK: type: QUERY +STAGE DEPENDENCIES: + Stage-1 is a root stage + Stage-0 depends on stages: Stage-1 + +STAGE PLANS: + Stage: Stage-1 + Map Reduce + Map Operator Tree: + TableScan + alias: src_union_1 + Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Filter Operator + predicate: (key = 86) (type: boolean) + Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Select Operator + expressions: value (type: string), ds (type: string) + outputColumnNames: _col0, _col1 + Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Union + Statistics: Num rows: 3 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Select Operator + expressions: 86 (type: int), _col0 (type: string), _col1 (type: string) + outputColumnNames: _col0, _col1, _col2 + Statistics: Num rows: 3 Data size: 0 Basic stats: PARTIAL Column stats: NONE + File Output Operator + compressed: false + Statistics: Num rows: 3 Data size: 0 Basic stats: PARTIAL Column stats: NONE + table: + input format: org.apache.hadoop.mapred.SequenceFileInputFormat + output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat + serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe + TableScan + alias: src_union_2 + Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Filter Operator + predicate: (key = 86) (type: boolean) + Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Select Operator + expressions: value (type: string), ds (type: string) + outputColumnNames: _col0, _col1 + Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Union + Statistics: Num rows: 3 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Select Operator + expressions: 86 (type: int), _col0 (type: string), _col1 (type: string) + outputColumnNames: _col0, _col1, _col2 + Statistics: Num rows: 3 Data size: 0 Basic stats: PARTIAL Column stats: NONE + File Output Operator + compressed: false + Statistics: Num rows: 3 Data size: 0 Basic stats: PARTIAL Column stats: NONE + table: + input format: org.apache.hadoop.mapred.SequenceFileInputFormat + output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat + serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe + TableScan + alias: src_union_3 + Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Filter Operator + predicate: (key = 86) (type: boolean) + Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Select Operator + expressions: value (type: string), ds (type: string) + outputColumnNames: _col0, _col1 + Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Union + Statistics: Num rows: 3 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Select Operator + expressions: 86 (type: int), _col0 (type: string), _col1 (type: string) + outputColumnNames: _col0, _col1, _col2 + Statistics: Num rows: 3 Data size: 0 Basic stats: PARTIAL Column stats: NONE + File Output Operator + compressed: false + Statistics: Num rows: 3 Data size: 0 Basic stats: PARTIAL Column stats: NONE + table: + input format: org.apache.hadoop.mapred.SequenceFileInputFormat + output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat + serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe + + Stage: Stage-0 + Fetch Operator + limit: -1 + Processor Tree: + ListSink + +PREHOOK: query: EXPLAIN SELECT key, value, ds FROM src_union_view WHERE key=86 AND ds ='1' +PREHOOK: type: QUERY +POSTHOOK: query: EXPLAIN SELECT key, value, ds FROM src_union_view WHERE key=86 AND ds ='1' +POSTHOOK: type: QUERY +STAGE DEPENDENCIES: + Stage-1 is a root stage + Stage-0 depends on stages: Stage-1 + +STAGE PLANS: + Stage: Stage-1 + Map Reduce + Map Operator Tree: + TableScan + alias: src_union_1 + Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Filter Operator + predicate: ((key = 86) and (ds = '1')) (type: boolean) + Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Select Operator + expressions: value (type: string) + outputColumnNames: _col0 + Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Union + Statistics: Num rows: 3 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Select Operator + expressions: 86 (type: int), _col0 (type: string), '1' (type: string) + outputColumnNames: _col0, _col1, _col2 + Statistics: Num rows: 3 Data size: 0 Basic stats: PARTIAL Column stats: NONE + File Output Operator + compressed: false + Statistics: Num rows: 3 Data size: 0 Basic stats: PARTIAL Column stats: NONE + table: + input format: org.apache.hadoop.mapred.SequenceFileInputFormat + output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat + serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe + TableScan + alias: src_union_2 + Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Filter Operator + predicate: ((key = 86) and (ds = '1')) (type: boolean) + Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Select Operator + expressions: value (type: string) + outputColumnNames: _col0 + Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Union + Statistics: Num rows: 3 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Select Operator + expressions: 86 (type: int), _col0 (type: string), '1' (type: string) + outputColumnNames: _col0, _col1, _col2 + Statistics: Num rows: 3 Data size: 0 Basic stats: PARTIAL Column stats: NONE + File Output Operator + compressed: false + Statistics: Num rows: 3 Data size: 0 Basic stats: PARTIAL Column stats: NONE + table: + input format: org.apache.hadoop.mapred.SequenceFileInputFormat + output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat + serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe + TableScan + alias: src_union_3 + Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Filter Operator + predicate: ((key = 86) and (ds = '1')) (type: boolean) + Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Select Operator + expressions: value (type: string) + outputColumnNames: _col0 + Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Union + Statistics: Num rows: 3 Data size: 0 Basic stats: PARTIAL Column stats: NONE + Select Operator + expressions: 86 (type: int), _col0 (type: string), '1' (type: string) + outputColumnNames: _col0, _col1, _col2 + Statistics: Num rows: 3 Data size: 0 Basic stats: PARTIAL Column stats: NONE + File Output Operator + compressed: false + Statistics: Num rows: 3 Data size: 0 Basic stats: PARTIAL Column stats: NONE + table: + input format: org.apache.hadoop.mapred.SequenceFileInputFormat + output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat + serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe + + Stage: Stage-0 + Fetch Operator + limit: -1 + Processor Tree: + ListSink + diff --git ql/src/test/results/clientpositive/union_view.q.out ql/src/test/results/clientpositive/union_view.q.out index badd209..530739e 100644 --- ql/src/test/results/clientpositive/union_view.q.out +++ ql/src/test/results/clientpositive/union_view.q.out @@ -358,12 +358,12 @@ STAGE PLANS: Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: value (type: string) - outputColumnNames: _col1 + outputColumnNames: _col0 Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE Union Statistics: Num rows: 252 Data size: 2656 Basic stats: COMPLETE Column stats: NONE Select Operator - expressions: 86 (type: int), _col1 (type: string), '1' (type: string) + expressions: 86 (type: int), _col0 (type: string), '1' (type: string) outputColumnNames: _col0, _col1, _col2 Statistics: Num rows: 252 Data size: 2656 Basic stats: COMPLETE Column stats: NONE File Output Operator @@ -382,12 +382,12 @@ STAGE PLANS: Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE Select Operator expressions: value (type: string) - outputColumnNames: _col1 + outputColumnNames: _col0 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE Union Statistics: Num rows: 252 Data size: 2656 Basic stats: COMPLETE Column stats: NONE Select Operator - expressions: 86 (type: int), _col1 (type: string), '1' (type: string) + expressions: 86 (type: int), _col0 (type: string), '1' (type: string) outputColumnNames: _col0, _col1, _col2 Statistics: Num rows: 252 Data size: 2656 Basic stats: COMPLETE Column stats: NONE File Output Operator @@ -406,12 +406,12 @@ STAGE PLANS: Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE Select Operator expressions: value (type: string) - outputColumnNames: _col1 + outputColumnNames: _col0 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE Union Statistics: Num rows: 252 Data size: 2656 Basic stats: COMPLETE Column stats: NONE Select Operator - expressions: 86 (type: int), _col1 (type: string), '1' (type: string) + expressions: 86 (type: int), _col0 (type: string), '1' (type: string) outputColumnNames: _col0, _col1, _col2 Statistics: Num rows: 252 Data size: 2656 Basic stats: COMPLETE Column stats: NONE File Output Operator @@ -471,12 +471,12 @@ STAGE PLANS: Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE Select Operator expressions: value (type: string) - outputColumnNames: _col1 + outputColumnNames: _col0 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE Union Statistics: Num rows: 502 Data size: 5312 Basic stats: COMPLETE Column stats: NONE Select Operator - expressions: 86 (type: int), _col1 (type: string), '2' (type: string) + expressions: 86 (type: int), _col0 (type: string), '2' (type: string) outputColumnNames: _col0, _col1, _col2 Statistics: Num rows: 502 Data size: 5312 Basic stats: COMPLETE Column stats: NONE File Output Operator @@ -495,12 +495,12 @@ STAGE PLANS: Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: value (type: string) - outputColumnNames: _col1 + outputColumnNames: _col0 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE Union Statistics: Num rows: 502 Data size: 5312 Basic stats: COMPLETE Column stats: NONE Select Operator - expressions: 86 (type: int), _col1 (type: string), '2' (type: string) + expressions: 86 (type: int), _col0 (type: string), '2' (type: string) outputColumnNames: _col0, _col1, _col2 Statistics: Num rows: 502 Data size: 5312 Basic stats: COMPLETE Column stats: NONE File Output Operator @@ -519,12 +519,12 @@ STAGE PLANS: Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE Select Operator expressions: value (type: string) - outputColumnNames: _col1 + outputColumnNames: _col0 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE Union Statistics: Num rows: 502 Data size: 5312 Basic stats: COMPLETE Column stats: NONE Select Operator - expressions: 86 (type: int), _col1 (type: string), '2' (type: string) + expressions: 86 (type: int), _col0 (type: string), '2' (type: string) outputColumnNames: _col0, _col1, _col2 Statistics: Num rows: 502 Data size: 5312 Basic stats: COMPLETE Column stats: NONE File Output Operator @@ -584,12 +584,12 @@ STAGE PLANS: Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE Select Operator expressions: value (type: string) - outputColumnNames: _col1 + outputColumnNames: _col0 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE Union Statistics: Num rows: 502 Data size: 5312 Basic stats: COMPLETE Column stats: NONE Select Operator - expressions: 86 (type: int), _col1 (type: string), '3' (type: string) + expressions: 86 (type: int), _col0 (type: string), '3' (type: string) outputColumnNames: _col0, _col1, _col2 Statistics: Num rows: 502 Data size: 5312 Basic stats: COMPLETE Column stats: NONE File Output Operator @@ -608,12 +608,12 @@ STAGE PLANS: Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE Select Operator expressions: value (type: string) - outputColumnNames: _col1 + outputColumnNames: _col0 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE Union Statistics: Num rows: 502 Data size: 5312 Basic stats: COMPLETE Column stats: NONE Select Operator - expressions: 86 (type: int), _col1 (type: string), '3' (type: string) + expressions: 86 (type: int), _col0 (type: string), '3' (type: string) outputColumnNames: _col0, _col1, _col2 Statistics: Num rows: 502 Data size: 5312 Basic stats: COMPLETE Column stats: NONE File Output Operator @@ -632,12 +632,12 @@ STAGE PLANS: Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: value (type: string) - outputColumnNames: _col1 + outputColumnNames: _col0 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE Union Statistics: Num rows: 502 Data size: 5312 Basic stats: COMPLETE Column stats: NONE Select Operator - expressions: 86 (type: int), _col1 (type: string), '3' (type: string) + expressions: 86 (type: int), _col0 (type: string), '3' (type: string) outputColumnNames: _col0, _col1, _col2 Statistics: Num rows: 502 Data size: 5312 Basic stats: COMPLETE Column stats: NONE File Output Operator @@ -701,12 +701,12 @@ STAGE PLANS: Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: value (type: string), ds (type: string) - outputColumnNames: _col1, _col2 + outputColumnNames: _col0, _col1 Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE Union Statistics: Num rows: 1250 Data size: 13280 Basic stats: COMPLETE Column stats: NONE Select Operator - expressions: _col1 (type: string), _col2 (type: string) + expressions: _col0 (type: string), _col1 (type: string) outputColumnNames: _col1, _col2 Statistics: Num rows: 1250 Data size: 13280 Basic stats: COMPLETE Column stats: NONE Reduce Output Operator @@ -723,12 +723,12 @@ STAGE PLANS: Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: value (type: string), ds (type: string) - outputColumnNames: _col1, _col2 + outputColumnNames: _col0, _col1 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE Union Statistics: Num rows: 1250 Data size: 13280 Basic stats: COMPLETE Column stats: NONE Select Operator - expressions: _col1 (type: string), _col2 (type: string) + expressions: _col0 (type: string), _col1 (type: string) outputColumnNames: _col1, _col2 Statistics: Num rows: 1250 Data size: 13280 Basic stats: COMPLETE Column stats: NONE Reduce Output Operator @@ -745,12 +745,12 @@ STAGE PLANS: Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: value (type: string), ds (type: string) - outputColumnNames: _col1, _col2 + outputColumnNames: _col0, _col1 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE Union Statistics: Num rows: 1250 Data size: 13280 Basic stats: COMPLETE Column stats: NONE Select Operator - expressions: _col1 (type: string), _col2 (type: string) + expressions: _col0 (type: string), _col1 (type: string) outputColumnNames: _col1, _col2 Statistics: Num rows: 1250 Data size: 13280 Basic stats: COMPLETE Column stats: NONE Reduce Output Operator @@ -1226,12 +1226,12 @@ STAGE PLANS: Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE Select Operator expressions: value (type: string) - outputColumnNames: _col1 + outputColumnNames: _col0 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE Union Statistics: Num rows: 252 Data size: 2656 Basic stats: COMPLETE Column stats: NONE Select Operator - expressions: 86 (type: int), _col1 (type: string), '4' (type: string) + expressions: 86 (type: int), _col0 (type: string), '4' (type: string) outputColumnNames: _col0, _col1, _col2 Statistics: Num rows: 252 Data size: 2656 Basic stats: COMPLETE Column stats: NONE File Output Operator @@ -1250,12 +1250,12 @@ STAGE PLANS: Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE Select Operator expressions: value (type: string) - outputColumnNames: _col1 + outputColumnNames: _col0 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE Union Statistics: Num rows: 252 Data size: 2656 Basic stats: COMPLETE Column stats: NONE Select Operator - expressions: 86 (type: int), _col1 (type: string), '4' (type: string) + expressions: 86 (type: int), _col0 (type: string), '4' (type: string) outputColumnNames: _col0, _col1, _col2 Statistics: Num rows: 252 Data size: 2656 Basic stats: COMPLETE Column stats: NONE File Output Operator @@ -1274,12 +1274,12 @@ STAGE PLANS: Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: value (type: string) - outputColumnNames: _col1 + outputColumnNames: _col0 Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE Union Statistics: Num rows: 252 Data size: 2656 Basic stats: COMPLETE Column stats: NONE Select Operator - expressions: 86 (type: int), _col1 (type: string), '4' (type: string) + expressions: 86 (type: int), _col0 (type: string), '4' (type: string) outputColumnNames: _col0, _col1, _col2 Statistics: Num rows: 252 Data size: 2656 Basic stats: COMPLETE Column stats: NONE File Output Operator