[ https://issues.apache.org/jira/browse/HIVE-21782?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Zoltán Borók-Nagy updated HIVE-21782: ------------------------------------- Description: Queries against views that contain query hints fail. {noformat} jdbc:hive2://localhost:11050/default> create view test as select /*+ MAPJOIN(time_dim) */ count(*) from store_sales join time_dim on (ss_sold_time_sk = t_time_sk); jdbc:hive2://localhost:11050/default> explain select * from test; Error: Error while compiling statement: FAILED: SemanticException line 1:32 missing EOF at '(' near 'count' in definition of VIEW test [ select MAPJOIN(time_dim) count(*) from `tpcds`.`store_sales` join `tpcds`.`time_dim` on (`store_sales`.`ss_sold_time_sk` = `time_dim`.`t_time_sk`) ] used as test at Line 1:22 (state=42000,code=40000) {noformat} Explain succeeds on same query but without using a view: {noformat} jdbc:hive2://localhost:11050/default> explain select /*+ MAPJOIN(time_dim) */ count(*) from store_sales join time_dim on (ss_sold_time_sk = t_time_sk);{noformat} {noformat} jdbc:hive2://localhost:11050/default> select version(); +----------------------------------------------------+ | _c0 | +----------------------------------------------------+ | 3.1.0.6.0.99.0-147 recc35d355ca45862fcf4a10cb6968a2a1dfad73f | +----------------------------------------------------+ {noformat} The above worked with Hive 2. was: Queries against views that contain query hints fail. {noformat} jdbc:hive2://localhost:11050/default> create view test as select /*+ MAPJOIN(time_dim) */ count(*) from store_sales join time_dim on (ss_sold_time_sk = t_time_sk); jdbc:hive2://localhost:11050/default> explain select * from test; Error: Error while compiling statement: FAILED: SemanticException line 1:32 missing EOF at '(' near 'count' in definition of VIEW test [ select MAPJOIN(time_dim) count(*) from `tpcds`.`store_sales` join `tpcds`.`time_dim` on (`store_sales`.`ss_sold_time_sk` = `time_dim`.`t_time_sk`) ] used as test at Line 1:22 (state=42000,code=40000) {noformat} Explain succeeds on same query but without using a view: {noformat} jdbc:hive2://localhost:11050/default> explain select /*+ MAPJOIN(time_dim) */ count(*) from store_sales join time_dim on (ss_sold_time_sk = t_time_sk);{noformat} {noformat} jdbc:hive2://localhost:11050/default> select version(); +----------------------------------------------------+ | _c0 | +----------------------------------------------------+ | 3.1.0.6.0.99.0-147 recc35d355ca45862fcf4a10cb6968a2a1dfad73f | +----------------------------------------------------+ {noformat} The above worked with Hive 2. > Cannot use query hints in views > ------------------------------- > > Key: HIVE-21782 > URL: https://issues.apache.org/jira/browse/HIVE-21782 > Project: Hive > Issue Type: Bug > Affects Versions: 3.1.0 > Reporter: Zoltán Borók-Nagy > Priority: Major > > Queries against views that contain query hints fail. > > {noformat} > jdbc:hive2://localhost:11050/default> create view test as select /*+ > MAPJOIN(time_dim) */ count(*) > from store_sales join time_dim on (ss_sold_time_sk = t_time_sk); > jdbc:hive2://localhost:11050/default> explain select * from test; > Error: Error while compiling statement: FAILED: SemanticException line 1:32 > missing EOF at '(' near 'count' in definition of VIEW test [ > select MAPJOIN(time_dim) count(*) from > `tpcds`.`store_sales` join `tpcds`.`time_dim` on > (`store_sales`.`ss_sold_time_sk` = `time_dim`.`t_time_sk`) > ] used as test at Line 1:22 (state=42000,code=40000) > {noformat} > Explain succeeds on same query but without using a view: > {noformat} > jdbc:hive2://localhost:11050/default> explain select /*+ MAPJOIN(time_dim) */ > count(*) > from store_sales join time_dim on (ss_sold_time_sk = t_time_sk);{noformat} > > {noformat} > jdbc:hive2://localhost:11050/default> select version(); > +----------------------------------------------------+ > | _c0 | > +----------------------------------------------------+ > | 3.1.0.6.0.99.0-147 recc35d355ca45862fcf4a10cb6968a2a1dfad73f | > +----------------------------------------------------+ > {noformat} > The above worked with Hive 2. > -- This message was sent by Atlassian JIRA (v7.6.3#76005)