Skip to content

HIVE-29529: Iceberg: Load table from cache HiveIcebergOutputCommitter#6394

Open
ayushtkn wants to merge 2 commits intoapache:masterfrom
ayushtkn:HIVE-29529
Open

HIVE-29529: Iceberg: Load table from cache HiveIcebergOutputCommitter#6394
ayushtkn wants to merge 2 commits intoapache:masterfrom
ayushtkn:HIVE-29529

Conversation

@ayushtkn
Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

Load table from cache in HiveIcebergOutputCommitter, whenever it is available

Why are the changes needed?

To avoid reloading the table

Does this PR introduce any user-facing change?

No

How was this patch tested?

CI

JobConf conf = jobContext.getJobConf();

table = Optional.ofNullable(table).orElseGet(() -> Catalogs.loadTable(conf, catalogProperties));
table = Optional.ofNullable(table).orElseGet(() -> IcebergTableUtil.getTable(conf, catalogProperties));
Copy link
Copy Markdown
Member

@deniskuzZ deniskuzZ Mar 30, 2026

Choose a reason for hiding this comment

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

i think we need a fresh copy, to check conflicts, not a cached one

Copy link
Copy Markdown
Member Author

@ayushtkn ayushtkn Mar 30, 2026

Choose a reason for hiding this comment

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

should it not break at time of commit? if our commit is conflicting? Means this is again reloading the table & reading the metadata which we already read once.

Between this and before we commit there could be another commit which could create conflict. I don't think we are under lock

In that case I believe some test would fail....

Copy link
Copy Markdown
Member

@deniskuzZ deniskuzZ Mar 30, 2026

Choose a reason for hiding this comment

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

let's see, i think it was intentional. there was no conflict found during commit. but if that's not needed, we could save some calls

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

cc @difin didn't you have some issue with that in a past?

@sonarqubecloud
Copy link
Copy Markdown

JobConf conf = jobContext.getJobConf();

table = Optional.ofNullable(table).orElseGet(() -> Catalogs.loadTable(conf, catalogProperties));
table = Optional.ofNullable(table).orElseGet(() -> IcebergTableUtil.getTable(conf, catalogProperties));
Copy link
Copy Markdown
Member

@deniskuzZ deniskuzZ Mar 30, 2026

Choose a reason for hiding this comment

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

with that change, if it works

    Table snapshotTable = Optional.ofNullable(IcebergAcidUtil.getTransaction(table))
        .map(Transaction::table)
        .orElse(table);

is not longer needed and could be simplified

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.

3 participants