Skip to content

Commit

Permalink
Use correct identity when talking to metastore in Iceberg
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Oct 12, 2021
1 parent 655d65d commit 059f8f0
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import io.trino.spi.TrinoException;
import io.trino.spi.connector.SchemaTableName;
import io.trino.spi.connector.TableNotFoundException;
import io.trino.spi.security.ConnectorIdentity;
import org.apache.hadoop.hive.metastore.TableType;
import org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe;
import org.apache.hadoop.mapred.FileInputFormat;
Expand Down Expand Up @@ -221,13 +220,11 @@ public void commit(@Nullable TableMetadata base, TableMetadata metadata)
}

PrincipalPrivileges privileges = buildInitialPrivilegeSet(table.getOwner());
ConnectorIdentity identity = ConnectorIdentity.ofUser(table.getOwner());
HiveIdentity context = new HiveIdentity(identity);
if (base == null) {
metastore.createTable(context, table, privileges);
metastore.createTable(identity, table, privileges);
}
else {
metastore.replaceTable(context, database, tableName, table, privileges);
metastore.replaceTable(identity, database, tableName, table, privileges);
}

shouldRefresh = true;
Expand Down

0 comments on commit 059f8f0

Please sign in to comment.