[ https://issues.apache.org/jira/browse/HIVE-25546?focusedWorklogId=658259&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-658259 ]
ASF GitHub Bot logged work on HIVE-25546: ----------------------------------------- Author: ASF GitHub Bot Created on: 30/Sep/21 10:55 Start Date: 30/Sep/21 10:55 Worklog Time Spent: 10m Work Description: kasakrisz commented on a change in pull request #2663: URL: https://github.com/apache/hive/pull/2663#discussion_r719291208 ########## File path: ql/src/test/queries/clientpositive/materialized_view_create_rewrite_8.q ########## @@ -0,0 +1,97 @@ +-- Test Incremental rebuild of materialized view without aggregate when a source table is insert only. + +SET hive.vectorized.execution.enabled=false; +set hive.support.concurrency=true; +set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager; +set hive.strict.checks.cartesian.product=false; +set hive.materializedview.rewriting=true; + +create table cmv_basetable_n6 (a int, b varchar(256), c decimal(10,2), d int) stored as orc TBLPROPERTIES ('transactional'='true'); + +insert into cmv_basetable_n6 values + (1, 'alfred', 10.30, 2), + (2, 'bob', 3.14, 3), + (2, 'bonnie', 172342.2, 3), + (3, 'calvin', 978.76, 3), + (3, 'charlie', 9.8, 1); + +create table cmv_basetable_2_n3 (a int, b varchar(256), c decimal(10,2), d int) stored as orc TBLPROPERTIES ('transactional'='true', 'transactional_properties'='insert_only'); + +insert into cmv_basetable_2_n3 values + (1, 'alfred', 10.30, 2), + (3, 'calvin', 978.76, 3); + +CREATE MATERIALIZED VIEW cmv_mat_view_n6 + TBLPROPERTIES ('transactional'='true') AS + SELECT cmv_basetable_n6.a, cmv_basetable_2_n3.c + FROM cmv_basetable_n6 JOIN cmv_basetable_2_n3 ON (cmv_basetable_n6.a = cmv_basetable_2_n3.a) + WHERE cmv_basetable_2_n3.c > 10.0; + +insert into cmv_basetable_2_n3 values + (3, 'charlie', 15.8, 1); + +-- CANNOT USE THE VIEW, IT IS OUTDATED +EXPLAIN CBO +SELECT cmv_basetable_n6.a +FROM cmv_basetable_n6 join cmv_basetable_2_n3 ON (cmv_basetable_n6.a = cmv_basetable_2_n3.a) +WHERE cmv_basetable_2_n3.c > 10.10; + +EXPLAIN +SELECT cmv_basetable_n6.a +FROM cmv_basetable_n6 join cmv_basetable_2_n3 ON (cmv_basetable_n6.a = cmv_basetable_2_n3.a) +WHERE cmv_basetable_2_n3.c > 10.10; Review comment: Yes. Originally there were no `EXPLAIN CBO` in other tests. Since I added it the `EXPLAIN` is not necessary. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 658259) Time Spent: 1h 50m (was: 1h 40m) > Enable incremental rebuild of Materialized views with insert only source > tables > ------------------------------------------------------------------------------- > > Key: HIVE-25546 > URL: https://issues.apache.org/jira/browse/HIVE-25546 > Project: Hive > Issue Type: Improvement > Components: CBO, Materialized views > Reporter: Krisztian Kasa > Assignee: Krisztian Kasa > Priority: Major > Labels: pull-request-available > Time Spent: 1h 50m > Remaining Estimate: 0h > > {code} > create table t1(a int, b int, c int) stored as parquet TBLPROPERTIES > ('transactional'='true', 'transactional_properties'='insert_only'); > create materialized view mat1 stored as orc TBLPROPERTIES > ('transactional'='true') as > select a, b, c from t1 where a > 10; > {code} > Currently materialized view *mat1* can not be rebuilt incrementally because > it has an insert only source table (t1). Such tables does not have > ROW_ID.write_id which is required to identify newly inserted records since > the last rebuild. > HIVE-25406 adds the ability to query write_id. -- This message was sent by Atlassian Jira (v8.3.4#803005)