[jira] [Updated] (HIVE-22816) QueryCache: Queries using views can have them cached after CTE expansion

2020-02-20 Thread Ashutosh Chauhan (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-22816?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ashutosh Chauhan updated HIVE-22816:

Fix Version/s: 4.0.0
   Resolution: Fixed
   Status: Resolved  (was: Patch Available)

Pushed to master. Thanks, [~gopalv]

> QueryCache: Queries using views can have them cached after CTE expansion
> 
>
> Key: HIVE-22816
> URL: https://issues.apache.org/jira/browse/HIVE-22816
> Project: Hive
>  Issue Type: Bug
>  Components: Query Processor
>Reporter: Gopal Vijayaraghavan
>Assignee: Gopal Vijayaraghavan
>Priority: Major
> Fix For: 4.0.0
>
> Attachments: HIVE-22816.1.patch
>
>
> {code}
> create view ss_null as select * from store_Sales where ss_Sold_date_sk is 
> null;
> select count(ss_ticket_number) from ss_null;
> with ss_null_cte as 
> (select * from store_Sales where ss_Sold_date_sk is null)
> select count(ss_ticket_number) from ss_null_cte;
> {code}
> Are treated differently by the query cache, however their execution is 
> identical.
> CBO rewrites the view query into AST form as follows
> {code}
> SELECT COUNT(`ss_ticket_number`) AS `$f0`
> FROM `tpcds_bin_partitioned_acid_orc_1`.`store_sales`
> WHERE `ss_sold_date_sk` IS NULL
> {code}
> But retains the write-entity for the VIRTUAL_VIEW for Ranger authorization 
> {code}
> 0: jdbc:hive2://localhost:10013> explain dependency select count(distinct 
> ss_ticket_number) from ss_null;
> ++
> |  Explain   |
> ++
> | 
> {"input_tables":[{"tablename":"tpcds_bin_partitioned_acid_orc_1@ss_null","tabletype":"VIRTUAL_VIEW"},{"tablename":"tpcds_bin_partitioned_acid_orc_1@store_sales","tabletype":"MANAGED_TABLE","tableParents":"[tpcds_bin_partitioned_acid_orc_1@ss_null]"}],"input_partitions":[{"partitionName":"tpcds_bin_partitioned_acid_orc_1@store_sales@ss_sold_date_sk=__HIVE_DEFAULT_PARTITION__"}]}
>  |
> ++
> {code}
> Causing Query cache to print out
> {code}
> parse.CalcitePlanner: Not eligible for results caching - query contains 
> non-transactional tables [ss_null]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-22816) QueryCache: Queries using views can have them cached after CTE expansion

2020-01-31 Thread Gopal Vijayaraghavan (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-22816?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gopal Vijayaraghavan updated HIVE-22816:

Status: Patch Available  (was: Open)

> QueryCache: Queries using views can have them cached after CTE expansion
> 
>
> Key: HIVE-22816
> URL: https://issues.apache.org/jira/browse/HIVE-22816
> Project: Hive
>  Issue Type: Bug
>  Components: Query Processor
>Reporter: Gopal Vijayaraghavan
>Assignee: Gopal Vijayaraghavan
>Priority: Major
> Attachments: HIVE-22816.1.patch
>
>
> {code}
> create view ss_null as select * from store_Sales where ss_Sold_date_sk is 
> null;
> select count(ss_ticket_number) from ss_null;
> with ss_null_cte as 
> (select * from store_Sales where ss_Sold_date_sk is null)
> select count(ss_ticket_number) from ss_null_cte;
> {code}
> Are treated differently by the query cache, however their execution is 
> identical.
> CBO rewrites the view query into AST form as follows
> {code}
> SELECT COUNT(`ss_ticket_number`) AS `$f0`
> FROM `tpcds_bin_partitioned_acid_orc_1`.`store_sales`
> WHERE `ss_sold_date_sk` IS NULL
> {code}
> But retains the write-entity for the VIRTUAL_VIEW for Ranger authorization 
> {code}
> 0: jdbc:hive2://localhost:10013> explain dependency select count(distinct 
> ss_ticket_number) from ss_null;
> ++
> |  Explain   |
> ++
> | 
> {"input_tables":[{"tablename":"tpcds_bin_partitioned_acid_orc_1@ss_null","tabletype":"VIRTUAL_VIEW"},{"tablename":"tpcds_bin_partitioned_acid_orc_1@store_sales","tabletype":"MANAGED_TABLE","tableParents":"[tpcds_bin_partitioned_acid_orc_1@ss_null]"}],"input_partitions":[{"partitionName":"tpcds_bin_partitioned_acid_orc_1@store_sales@ss_sold_date_sk=__HIVE_DEFAULT_PARTITION__"}]}
>  |
> ++
> {code}
> Causing Query cache to print out
> {code}
> parse.CalcitePlanner: Not eligible for results caching - query contains 
> non-transactional tables [ss_null]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HIVE-22816) QueryCache: Queries using views can have them cached after CTE expansion

2020-01-31 Thread Gopal Vijayaraghavan (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-22816?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gopal Vijayaraghavan updated HIVE-22816:

Attachment: HIVE-22816.1.patch

> QueryCache: Queries using views can have them cached after CTE expansion
> 
>
> Key: HIVE-22816
> URL: https://issues.apache.org/jira/browse/HIVE-22816
> Project: Hive
>  Issue Type: Bug
>  Components: Query Processor
>Reporter: Gopal Vijayaraghavan
>Assignee: Gopal Vijayaraghavan
>Priority: Major
> Attachments: HIVE-22816.1.patch
>
>
> {code}
> create view ss_null as select * from store_Sales where ss_Sold_date_sk is 
> null;
> select count(ss_ticket_number) from ss_null;
> with ss_null_cte as 
> (select * from store_Sales where ss_Sold_date_sk is null)
> select count(ss_ticket_number) from ss_null_cte;
> {code}
> Are treated differently by the query cache, however their execution is 
> identical.
> CBO rewrites the view query into AST form as follows
> {code}
> SELECT COUNT(`ss_ticket_number`) AS `$f0`
> FROM `tpcds_bin_partitioned_acid_orc_1`.`store_sales`
> WHERE `ss_sold_date_sk` IS NULL
> {code}
> But retains the write-entity for the VIRTUAL_VIEW for Ranger authorization 
> {code}
> 0: jdbc:hive2://localhost:10013> explain dependency select count(distinct 
> ss_ticket_number) from ss_null;
> ++
> |  Explain   |
> ++
> | 
> {"input_tables":[{"tablename":"tpcds_bin_partitioned_acid_orc_1@ss_null","tabletype":"VIRTUAL_VIEW"},{"tablename":"tpcds_bin_partitioned_acid_orc_1@store_sales","tabletype":"MANAGED_TABLE","tableParents":"[tpcds_bin_partitioned_acid_orc_1@ss_null]"}],"input_partitions":[{"partitionName":"tpcds_bin_partitioned_acid_orc_1@store_sales@ss_sold_date_sk=__HIVE_DEFAULT_PARTITION__"}]}
>  |
> ++
> {code}
> Causing Query cache to print out
> {code}
> parse.CalcitePlanner: Not eligible for results caching - query contains 
> non-transactional tables [ss_null]
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)