Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test iceberg_tables function with TrinoSnowflakeCatalog #24593

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lukasz-stec
Copy link
Member

Description

Implement a simple test for the system.iceberg_tables table function for the TrinoSnowflakeCatalog.
Since TrinoSnowflakeCatalog is read only the original generic test does not work.
Theoretically, we could apply the modifications directly on the snowflake to match the generic test with multiple schemas. However, that seems like an overkill given the implementation just delegates to the listTables method and maps the results.

Additional context and related issues

Release notes

( X) 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}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Dec 30, 2024
@lukasz-stec lukasz-stec requested a review from ebyhr December 30, 2024 12:50
@github-actions github-actions bot added the iceberg Iceberg connector label Dec 30, 2024
Comment on lines +692 to +697
String schemaTablesValues = "VALUES " + getQueryRunner()
.execute("SELECT table_schema, table_name FROM iceberg.information_schema.tables WHERE table_schema='%s'".formatted(SNOWFLAKE_TEST_SCHEMA.toLowerCase(ENGLISH)))
.getMaterializedRows().stream()
.map(row -> "('%s', '%s')".formatted(row.getField(0), row.getField(1)))
.collect(joining(", "));
assertQuery("SELECT * FROM TABLE(iceberg.system.iceberg_tables(SCHEMA_NAME => '%s'))".formatted(SNOWFLAKE_TEST_SCHEMA.toLowerCase(ENGLISH)), schemaTablesValues);
Copy link
Member

Choose a reason for hiding this comment

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

I think this test is flaky. What happens if a new object is created after listing iceberg.information_schema.tables and before executing iceberg_tables function?

Copy link
Member Author

Choose a reason for hiding this comment

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

That was the reason the generic test creates its own schemas but in this case, it is not needed because this test does not create iceberg tables other than potentially during setup.
There is one test that creates a native table but that will not be listed by TrinoSnowflakeCatalog#listTables

@lukasz-stec lukasz-stec requested a review from ebyhr January 1, 2025 12:04
@lukasz-stec
Copy link
Member Author

@ebyhr could you run with secrets to actually run this test?

@raunaqmorarka
Copy link
Member

/test-with-secrets sha=181dc8c8651fdc68b83c9d3d520ef87e13a3f6b7

Copy link

github-actions bot commented Jan 2, 2025

The CI workflow run with tests that require additional secrets has been started: https://github.com/trinodb/trino/actions/runs/12583104964

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.

3 participants