Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-5272

Column statistics on a invalid column name results in IndexOutOfBoundsException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.13.0
    • 0.13.0
    • Statistics

    Description

      When invalid column name is specified for column statistics IndexOutOfBoundsException is thrown.

      hive> analyze table customer_staging compute statistics for columns c_first_name, invalid_name, c_customer_sk;
      FAILED: IndexOutOfBoundsException Index: 2, Size: 1

      If the invalid column name appears at first or last then INVALID_COLUMN_REFERENCE is thrown at query planning stage. But if the invalid column name appears somewhere in the middle of column lists then IndexOutOfBoundsException is thrown at semantic analysis step. The problem is with getTableColumnType() and getPartitionColumnType() methods. The following segment

          for (int i=0; i <numCols; i++) {
            colName = colNames.get(i);
            for (FieldSchema col: cols) {
              if (colName.equalsIgnoreCase(col.getName())) {
                colTypes.add(i, new String(col.getType()));
              }
            }
          }

      is the reason for it. If the invalid column names appears in the middle of column list then the equalsIgnoreCase() skips the invalid name and increments the i. Since the list is not initialized it results in exception.

      Attachments

        1. junit-noframes.html
          74 kB
          Prasanth Jayachandran
        2. HIVE-5272.3.patch.txt
          4 kB
          Prasanth Jayachandran
        3. HIVE-5272.2.patch.txt
          4 kB
          Prasanth Jayachandran
        4. HIVE-5272.1.patch.txt
          2 kB
          Prasanth Jayachandran

        Activity

          People

            prasanth_j Prasanth Jayachandran
            prasanth_j Prasanth Jayachandran
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: