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

TrinoHiveCatalog listTables should list all tables #11617

Merged
merged 1 commit into from
Apr 4, 2022

Conversation

alexjo2144
Copy link
Member

@alexjo2144 alexjo2144 commented Mar 22, 2022

Description

Excluding non-Iceberg tables makes a schema seem empty
when it is not.

Revert of #1354

One situation that is confusing right now is dropping a schema that has only hive tables in it. DROP SCHEMA iceberg.my_schema will fail because the schema is not empty (in that case the exception comes from the HMS, not Trino because Trino thinks the schema is empty). A SHOW TABLES FROM iceberg.my_schema would come back empty.

it'll also be relevant for table redirections #11356. In order to redirect a table, the iceberg catalog needs to know it exists.

This also brings the iceberg connector in line with the Hive connector. Listing shows all available tables in the HMS.

Is this change a fix, improvement, new feature, refactoring, or other?

Fix

Is this a change to the core query engine, a connector, client library, or the SPI interfaces? (be specific)

Iceberg Connector with HMS

How would you describe this change to a non-technical end user or system administrator?

Related issues, pull requests, and links

Documentation

(x) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.

Release notes

( ) No release notes entries required.
(x) Release notes entries required with the following suggested text:

# Section
* List all tables when using the Iceberg HMS catalog

@@ -286,22 +281,9 @@ public Transaction newCreateTableTransaction(
public List<SchemaTableName> listTables(ConnectorSession session, Optional<String> namespace)
{
ImmutableSet.Builder<SchemaTableName> tablesListBuilder = ImmutableSet.builder();
listNamespaces(session, namespace)
Copy link
Contributor

Choose a reason for hiding this comment

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

For context, this is the initial commit which added the filtering of Iceberg tables in the listing:

a2ea77b

Copy link
Member Author

Choose a reason for hiding this comment

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

Even farther back #1354

@findinpath
Copy link
Contributor

What is expected actually from a functional point of view when saying "show tables" in hive/iceberg/delta?
Are we supposed to show ALL the tables irrespective of their underlying format or are we supposed to show only the tables which can be read by the connector (or something else that I haven't thought about)?

@findepi
Copy link
Member

findepi commented Mar 23, 2022

Are we supposed to show ALL the tables irrespective of their underlying format or are we supposed to show only the tables which can be read by the connector

The latter is preferred, but not always possible do achieve in a performant manner. The former is acceptable.

In case of redirections, this should be "all tables which can be read by a user" => all tables (reasonably good approximation).

@@ -65,4 +67,22 @@ public void testHiveSelectFromIcebergTable()

onTrino().executeQuery("DROP TABLE iceberg.default." + tableName);
}

@Test(groups = {ICEBERG, STORAGE_FORMATS, HMS_ONLY})
Copy link
Contributor

Choose a reason for hiding this comment

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

Please create a follow-up to add eventually the same tests for hive-delta duo.

@alexjo2144 alexjo2144 force-pushed the iceberg/list-tables branch from f1c269d to 9f3614f Compare March 28, 2022 18:09
@alexjo2144
Copy link
Member Author

AC and resolved merge conflicts

@alexjo2144 alexjo2144 requested a review from findepi March 28, 2022 18:10
Comment on lines -360 to -361
// TODO: support redirects from Iceberg to Hive
assertThat(readTableComment("iceberg", "default", tableName)).hasNoRows();
Copy link
Member

Choose a reason for hiding this comment

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

Looks like this fixes a (small) bug, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Without redirections hiding the non-Iceberg tables could have been nice to have, at the cost of making drop schema sometimes fail in confusing ways

Once we have redirections, hiding these tables would certainly be a bug

@findepi
Copy link
Member

findepi commented Apr 1, 2022

AC and resolved merge conflicts

please rebase again, since there are new merge conflicts. sorry

@alexjo2144 alexjo2144 force-pushed the iceberg/list-tables branch from 9f3614f to b6a63e7 Compare April 1, 2022 14:32
@alexjo2144
Copy link
Member Author

Rebased again, thanks

Excluding non-Iceberg tables makes a schema seem empty
when it is not.
@alexjo2144 alexjo2144 force-pushed the iceberg/list-tables branch from b6a63e7 to 1e6fd96 Compare April 1, 2022 20:12
@findepi findepi merged commit d6f16fb into trinodb:master Apr 4, 2022
@github-actions github-actions bot added this to the 376 milestone Apr 4, 2022
@alexjo2144 alexjo2144 deleted the iceberg/list-tables branch April 4, 2022 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants