Skip to content

Commit

Permalink
Avoid reloading the Iceberg table
Browse files Browse the repository at this point in the history
  • Loading branch information
findinpath authored and findepi committed Sep 19, 2022
1 parent 39e2ff2 commit d562faf
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -695,8 +695,11 @@ public Optional<ConnectorOutputMetadata> finishCreateTable(ConnectorSession sess
public Optional<ConnectorTableLayout> getInsertLayout(ConnectorSession session, ConnectorTableHandle tableHandle)
{
IcebergTableHandle table = (IcebergTableHandle) tableHandle;
Table icebergTable = catalog.loadTable(session, table.getSchemaTableName());
return getWriteLayout(icebergTable.schema(), icebergTable.spec(), false);
Schema schema = SchemaParser.fromJson(table.getTableSchemaJson());
PartitionSpec partitionSpec = PartitionSpecParser.fromJson(
schema,
table.getPartitionSpecJson().orElseThrow(() -> new VerifyException("Partition spec missing in the table handle")));
return getWriteLayout(schema, partitionSpec, false);
}

private Optional<ConnectorTableLayout> getWriteLayout(Schema tableSchema, PartitionSpec partitionSpec, boolean forceRepartitioning)
Expand Down

0 comments on commit d562faf

Please sign in to comment.