Skip to content

HIVE-29496: Subsequent transactional materialized view rebuild fails when source tables are iceberg tables#6434

Open
kasakrisz wants to merge 4 commits intoapache:masterfrom
kasakrisz:HIVE-29496-master-acid-mv-lock
Open

HIVE-29496: Subsequent transactional materialized view rebuild fails when source tables are iceberg tables#6434
kasakrisz wants to merge 4 commits intoapache:masterfrom
kasakrisz:HIVE-29496-master-acid-mv-lock

Conversation

@kasakrisz
Copy link
Copy Markdown
Contributor

@kasakrisz kasakrisz commented Apr 15, 2026

What changes were proposed in this pull request?

Open an ACID transaction before lock acquisition for materialized view rebuilds

Why are the changes needed?

When the base tables of an MV are not ACID tables no ACID txn is opened before generating the MV rebuild plan and the current transaction ID defaults to 0, and this value is passed to the lock acquisition request. This prevents the subsequent rebuild of transactional MVs when the source tables are Iceberg.

When source tables are ACID-compliant, the transaction ID is set before the rebuild plan is generated; therefore, this scenario remains unaffected.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

mvn test -Dtest.output.overwrite -Dtest=TestIcebergLlapLocalCliDriver -Dqfile=mv_iceberg_orc9.q -pl itests/qtest-iceberg -Pitests

create table ice_basetable (a int, b string) stored by iceberg;
insert into ice_basetable values (1, 'alfred'),(2, 'bob'),(2, 'bonnie'),(3, 'calvin'),(3, 'charlie');

create materialized view mv_acid STORED AS ORC TBLPROPERTIES ('transactional'='true') as
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking out loud: shouldn't we add a test case when the MV itself stored by iceberg?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kasakrisz kasakrisz force-pushed the HIVE-29496-master-acid-mv-lock branch from b347405 to 3634e3c Compare April 28, 2026 08:09
@kasakrisz kasakrisz requested a review from deniskuzZ April 28, 2026 08:11
Copy link
Copy Markdown
Member

@deniskuzZ deniskuzZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, pending tests

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants