Skip to content

Conversation

@WillPelech
Copy link

@WillPelech WillPelech commented Nov 14, 2025

Description

This PR adds a test case to BaseConnectorSmokeTest testing that analyze works correctly if the connector supports the operation. If the test fails then it is because of lack of support so the test will then check that the test is indeed true for the underlying connector.

Additional context and related issues

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.
( ) Release notes are required, with the following suggested text:

## Section
* Fix some things. ({issue}`#27273`)

@cla-bot
Copy link

cla-bot bot commented Nov 14, 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 cla@trino.io. 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 Nov 14, 2025
"NOT_SUPPORTED");
}
finally {
assertUpdate("DROP TABLE IF EXISTS " + tableName);
Copy link
Member

Choose a reason for hiding this comment

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

Could you use TestTable class instead?

Comment on lines +903 to +904
assertThat(query("SELECT count(*) FROM " + tableName))
.matches("VALUES BIGINT '25'");
Copy link
Member

Choose a reason for hiding this comment

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

No need to verify the row count. I would remove this assertion.

Comment on lines +906 to +908
assertThat(computeActual("SHOW STATS FOR " + tableName).getRowCount())
.as("Statistics should be collected after ANALYZE")
.isGreaterThan(0);
Copy link
Member

Choose a reason for hiding this comment

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

Could you verify distinct_values_count field instead of the row count?

String tableName = "test_analyze_" + randomNameSuffix();

try {
assertUpdate("CREATE TABLE " + tableName + " AS SELECT * FROM nation", 25);
Copy link
Member

Choose a reason for hiding this comment

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

We should verify the following ANALYZE collected NDV. Could you use a session disabling collect_extended_statistics_on_write property?

Comment on lines +913 to +916
.containsAnyOf(
"S3 Tables do not support analyze",
"do not support analyze",
"NOT_SUPPORTED");
Copy link
Member

Choose a reason for hiding this comment

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

We could add a helper method (e.g. errorMessageForAnalyze) and make unsupported test classes override the method.

}
}

@Test
Copy link
Member

Choose a reason for hiding this comment

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

Added BaseConnectorSmokeTest for Analyze to test different catalogs

Could you change both PR and commit title to "Test ANALYZE in BaseIcebergConnectorSmokeTest"?

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

Labels

iceberg Iceberg connector

Development

Successfully merging this pull request may close these issues.

2 participants