hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Chu (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HIVE-5623) ORC accessing array column that's empty will fail with java out of bound exception
Date Wed, 23 Oct 2013 07:41:41 GMT
Eric Chu created HIVE-5623:
------------------------------

             Summary: ORC accessing array column that's empty will fail with java out of bound
exception
                 Key: HIVE-5623
                 URL: https://issues.apache.org/jira/browse/HIVE-5623
             Project: Hive
          Issue Type: Bug
          Components: File Formats
    Affects Versions: 0.11.0
            Reporter: Eric Chu
            Priority: Critical


In our ORC tests we saw that queries that work on RCFile failed on the corresponding ORC version
with Java IndexOutOfBoundsException in OrcStruct.java. The queries failed b/c the table has
an array type column and there are rows with an empty array.  We noticed that the getList(Object
list, int i) method in OrcStruct.java simply returns the i-th element from list without checking
if list is not null or if i is within valid range. After fixing that the queries run fine.
The fix is really simple, but maybe there are other similar cases that need to be handled.
The fix is to check if listObj is null and if i falls within range:

    public Object getListElement(Object listObj, int i) {
      if (listObj == null) {
          return null;
      }
      List list = ((List) listObj);
      if (i < 0 || i >= list.size()) {
          return null;
      }
      return list.get(i);
    }





--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message