Skip to content

Commit

Permalink
Avoid redundant metastore calls for non-system Iceberg tables
Browse files Browse the repository at this point in the history
Cherry-pick of trinodb/trino@d29fcd9

Co-Authored-By: Piotr Findeisen <piotr.findeisen@gmail.com>
  • Loading branch information
2 people authored and zhenxiao committed Mar 9, 2022
1 parent 1066c99 commit bb0ee5c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ public IcebergTableHandle getTableHandle(ConnectorSession session, SchemaTableNa
public Optional<SystemTable> getSystemTable(ConnectorSession session, SchemaTableName tableName)
{
IcebergTableName name = IcebergTableName.from(tableName.getTableName());
if (name.getTableType() == DATA) {
return Optional.empty();
}

TableIdentifier tableIdentifier = toIcebergTableIdentifier(tableName.getSchemaName(), name.getTableName());
Table table;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ public Optional<SystemTable> getSystemTable(ConnectorSession session, SchemaTabl
private Optional<SystemTable> getRawSystemTable(ConnectorSession session, SchemaTableName tableName)
{
IcebergTableName name = IcebergTableName.from(tableName.getTableName());
if (name.getTableType() == DATA) {
return Optional.empty();
}

MetastoreContext metastoreContext = new MetastoreContext(session.getIdentity(), session.getQueryId(), session.getClientInfo(), session.getSource(), Optional.empty(), false, HiveColumnConverterProvider.DEFAULT_COLUMN_CONVERTER_PROVIDER);
Optional<Table> hiveTable = metastore.getTable(metastoreContext, tableName.getSchemaName(), name.getTableName());
Expand Down

0 comments on commit bb0ee5c

Please sign in to comment.