[ https://issues.apache.org/jira/browse/HIVE-18390?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16314538#comment-16314538 ]
Hengyu Dai edited comment on HIVE-18390 at 1/8/18 6:27 AM: ----------------------------------------------------------- [~ashutoshc] [~pxiong] Could you please check this issue ? was (Author: hengyu.dai): [~ashutoshc] Could you please check this issue pls? > 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 > Attachments: HIVE-18390.patch > > > 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)