You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Hengyu Dai (JIRA)" <ji...@apache.org> on 2018/01/06 12:14:00 UTC

[jira] [Created] (HIVE-18390) IndexOutOfBoundsException when query a partitioned view in ColumnPruner

Hengyu Dai created HIVE-18390:
---------------------------------

             Summary: IndexOutOfBoundsException when query a  partitioned view in ColumnPruner 
                 Key: HIVE-18390
                 URL: https://issues.apache.org/jira/browse/HIVE-18390
             Project: Hive
          Issue Type: Bug
          Components: Query Planning, Views
    Affects Versions: 2.1.1
            Reporter: Hengyu Dai


IndexOutOfBoundsException is encountered when query a partitioned view.
in Column Prunning, each SEL operator collects the accessed column in current SEL operator,
When ColumnPrunerSelectProc getting a view's columns accessed, it will first get the index of output column names in the view, then call Table.getCols().get(index).getName() to finally get the 
name of output column, but Table.getCols() will not return all columns (partitioned column is
lacked), so if partitioned columns is queried, an IndexOutOfBoundsException will throw.

REPRODUCE: 
{code:sql}
create table foo
(
`a` string
) partitioned by (`b` string)
;

create view bar partitioned on (b) as
select a,b from foo;

select * from bar;     --IndexOutOfBoundsException
{code}

OPERATORE TREE:
{code:java}
TS[0]
   |
SEL[1]
   |
SEL[2]
   |
FS[3]
{code}
SEL[1] collects accessed column(contains partitioned column b), b's internal column name is '_col1', the corresponding column index is 1, but actually bar's getCols() returned a list of length 1: ['a'], so tab.getCols().get(1) throw tab.getCols().get(index)

HOW TO FIX:
instead of call view's getCols() method, we should get all columns including partitioned columns






--
This message was sent by Atlassian JIRA
(v6.4.14#64029)