Skip to content

Conversation

@yangshangqing95
Copy link
Member

@yangshangqing95 yangshangqing95 commented Sep 19, 2025

Description

This PR fixes failures when running EXPLAIN and EXPLAIN ANALYZE on Iceberg OPTIMIZE statements:

  1. Fixed server-side failure in EXPLAIN; EXPLAIN prints an error on the server side, which is only ignored because of the IGNORE_STATS_CALCULATOR_FAILURES session property. When this property is set to false, it can still cause the query to fail.

    • Exception example:
      java.lang.IllegalArgumentException: Unexpected scanned files recording set
      	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:141)
      	at io.trino.plugin.iceberg.IcebergMetadata.getTableStatistics(IcebergMetadata.java:3546)
      	at io.trino.plugin.base.classloader.ClassLoaderSafeConnectorMetadata.getTableStatistics(ClassLoaderSafeConnectorMetadata.java:356)
      	at io.trino.tracing.TracingConnectorMetadata.getTableStatistics(TracingConnectorMetadata.java:333)
      	at io.trino.metadata.MetadataManager.getTableStatistics(MetadataManager.java:492)
      	at io.trino.tracing.TracingMetadata.getTableStatistics(TracingMetadata.java:318)
      	at io.trino.cost.CachingTableStatsProvider.getTableStatisticsInternal(CachingTableStatsProvider.java:53)
      	at java.base/java.util.Map.computeIfAbsent(Map.java:1067)
         .......
      
  2. Fixed failure in EXPLAIN ANALYZE OPTIMIZE.

This change ensures both EXPLAIN and EXPLAIN ANALYZE OPTIMIZE queries complete without errors.

Additional context and related issues

Fixes #26598

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text:

## Iceberg
* Fix failures when running EXPLAIN or EXPLAIN ANALYZE on `ALTER TABLE EXECUTE OPTIMIZE` queries. ({issue}`26598`)

@cla-bot
Copy link

cla-bot bot commented Sep 19, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@github-actions github-actions bot added the iceberg Iceberg connector label Sep 19, 2025
@raunaqmorarka
Copy link
Member

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Oct 6, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@cla-bot
Copy link

cla-bot bot commented Oct 6, 2025

The cla-bot has been summoned, and re-checked this pull request!

@cla-bot
Copy link

cla-bot bot commented Oct 6, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@cla-bot
Copy link

cla-bot bot commented Oct 6, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@yangshangqing95
Copy link
Member Author

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Oct 7, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@cla-bot
Copy link

cla-bot bot commented Oct 7, 2025

The cla-bot has been summoned, and re-checked this pull request!

@chenjian2664
Copy link
Contributor

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Oct 12, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@cla-bot
Copy link

cla-bot bot commented Oct 12, 2025

The cla-bot has been summoned, and re-checked this pull request!

@yangshangqing95
Copy link
Member Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed label Oct 17, 2025
@cla-bot
Copy link

cla-bot bot commented Oct 17, 2025

The cla-bot has been summoned, and re-checked this pull request!

Copy link
Member

@raunaqmorarka raunaqmorarka left a comment

Choose a reason for hiding this comment

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

minor comments around tests, lgtm otherwise

@raunaqmorarka raunaqmorarka changed the title Fix failures for EXPLAIN and EXPLAIN ANALYZE on Iceberg OPTIMIZE queries Fix failures for EXPLAIN and EXPLAIN ANALYZE on OPTIMIZE queries Oct 22, 2025
@raunaqmorarka raunaqmorarka requested a review from ebyhr October 22, 2025 11:28
Copy link
Member

@raunaqmorarka raunaqmorarka left a comment

Choose a reason for hiding this comment

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

Please rebase to latest master

@yangshangqing95 yangshangqing95 force-pushed the fix-explain-optimize branch 2 times, most recently from f398d1b to 6b16235 Compare October 22, 2025 19:26
@yangshangqing95
Copy link
Member Author

Please rebase to latest master
sure, rebased

1. Fixed server-side failure in EXPLAIN; when IGNORE_STATS_CALCULATOR_FAILURES is false, the query failed.
2. Fixed failure in EXPLAIN ANALYZE OPTIMIZE.
@raunaqmorarka raunaqmorarka merged commit 550371a into trinodb:master Oct 23, 2025
192 of 195 checks passed
@github-actions github-actions bot added this to the 478 milestone Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed iceberg Iceberg connector

Development

Successfully merging this pull request may close these issues.

EXPLAIN ANALYZE with ALTER TABLE ... EXECUTE optimize on unpartition tables shows exception message

3 participants