FAQ
Repository: hive
Updated Branches:
   refs/heads/branch-1 05e609638 -> 95f2bd8d4


HIVE-11603: IndexOutOfBoundsException thrown when accessing a union all subquery and filtering on a column which does not exist in all underlying tables (Laljo John Pullokkaran, reviewed by Jesus Camacho Rodriguez )


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/95f2bd8d
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/95f2bd8d
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/95f2bd8d

Branch: refs/heads/branch-1
Commit: 95f2bd8d43ebc47925f604b4d2f98bd40b6361ed
Parents: 05e6096
Author: jpullokk <jpullokk@apache.org>
Authored: Wed Jan 6 13:50:58 2016 -0800
Committer: jpullokk <jpullokk@apache.org>
Committed: Wed Jan 6 13:50:58 2016 -0800

----------------------------------------------------------------------
  .../java/org/apache/hadoop/hive/ql/exec/UnionOperator.java | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/95f2bd8d/ql/src/java/org/apache/hadoop/hive/ql/exec/UnionOperator.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/UnionOperator.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/UnionOperator.java
index 9bbaadd..9f33ab3 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/UnionOperator.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/UnionOperator.java
@@ -62,13 +62,16 @@ public class UnionOperator extends Operator<UnionDesc> implements Serializable {
      int parents = parentOperators.size();
      parentObjInspectors = new StructObjectInspector[parents];
      parentFields = new List[parents];
+ int columns = 0;
      for (int p = 0; p < parents; p++) {
        parentObjInspectors[p] = (StructObjectInspector) inputObjInspectors[p];
        parentFields[p] = parentObjInspectors[p].getAllStructFieldRefs();
+ if (p == 0 || parentFields[p].size() < columns) {
+ columns = parentFields[p].size();
+ }
      }

      // Get columnNames from the first parent
- int columns = parentFields[0].size();
      ArrayList<String> columnNames = new ArrayList<String>(columns);
      for (int c = 0; c < columns; c++) {
        columnNames.add(parentFields[0].get(c).getFieldName());
@@ -81,7 +84,8 @@ public class UnionOperator extends Operator<UnionDesc> implements Serializable {
      }

      for (int p = 0; p < parents; p++) {
- assert (parentFields[p].size() == columns);
+ // When columns is 0, the union operator is empty.
+ assert (columns == 0 || parentFields[p].size() == columns);
        for (int c = 0; c < columns; c++) {
          if (!columnTypeResolvers[c].updateForUnionAll(parentFields[p].get(c)
              .getFieldObjectInspector())) {

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupcommits @
categorieshive, hadoop
postedJan 6, '16 at 9:52p
activeJan 6, '16 at 9:52p
posts1
users1
websitehive.apache.org

1 user in discussion

Jpullokk: 1 post

People

Translate

site design / logo © 2021 Grokbase