Skip to content

fix: list tables without their metadata tables - #171

Open
NoahKusaba wants to merge 1 commit into
apache:mainfrom
NoahKusaba:fix/list-only-real-tables
Open

NoahKusaba wants to merge 1 commit into
apache:mainfrom
NoahKusaba:fix/list-only-real-tables

Conversation

@NoahKusaba

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

None filed; the change is small enough to explain here.

Rationale for this change

IcebergSchemaProvider::table_names() listed t$snapshots, t$manifests and t$history for every table t:

  • SHOW TABLES showed each one as a BASE TABLE, so a namespace with three tables listed twelve.
  • information_schema calls table() for every listed name, and each $ lookup loads t from the catalog again. information_schema.columns loaded every table four times.

Other engines list only tables and resolve metadata tables when a query names them:

  • Spark: Iceberg's SparkCatalog.listTables returns the catalog's tables; db.t.snapshots is recognised in loadTable.
  • Trino: the Iceberg connector's listTables returns the catalog's tables; t$snapshots resolves through getSystemTable.
  • Flink: Iceberg's FlinkCatalog.listTables returns the catalog's tables; t$snapshots is split on $ when it's looked up.

What changes are included in this PR?

table_names() lists only the tables. t$snapshots and the other metadata tables still resolve by name through table(), and table_exist() still reports them, so CREATE EXTERNAL TABLE can't take a metadata table's name.

Are these changes tested?

Yes. The SHOW TABLES expectations in show_tables.slt and test_provider_list_table_names lose the $ names. Querying metadata tables by name is still covered by metadata_tables.rs and insert_into.slt, unchanged.

Are there any user-facing changes?

Yes: SHOW TABLES and information_schema no longer list metadata tables. They can still be queried by name, e.g. SELECT * FROM t$snapshots.

`table_names()` listed `t$snapshots`, `t$manifests` and `t$history` for
every table. `SHOW TABLES` showed them as base tables, and
`information_schema` looked each one up, loading every table from the
catalog four times. Spark, Trino and Flink list only tables and resolve
metadata tables by name, which still works here.
@NoahKusaba

Copy link
Copy Markdown
Contributor Author

ez merge

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant