Skip to content

Commit

Permalink
Refactor HiveMetadataFactory
Browse files Browse the repository at this point in the history
Separate instantiation from other logic.
  • Loading branch information
findepi committed Jun 23, 2021
1 parent 55cba82 commit f39b4d8
Showing 1 changed file with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
import io.trino.plugin.hive.metastore.HiveMetastore;
import io.trino.plugin.hive.metastore.MetastoreConfig;
import io.trino.plugin.hive.metastore.SemiTransactionalHiveMetastore;
import io.trino.plugin.hive.security.AccessControlMetadata;
import io.trino.plugin.hive.security.AccessControlMetadataFactory;
import io.trino.plugin.hive.statistics.HiveStatisticsProvider;
import io.trino.plugin.hive.statistics.MetastoreHiveStatisticsProvider;
import io.trino.spi.type.TypeManager;

Expand Down Expand Up @@ -182,7 +184,7 @@ public TransactionalMetadata create()
hiveTransactionHeartbeatInterval,
heartbeatService);

return new HiveMetadata(
return create(
catalogName,
metastore,
hdfsEnvironment,
Expand All @@ -200,4 +202,41 @@ public TransactionalMetadata create()
hiveMaterializedViewMetadataFactory.create(hiveMetastoreClosure),
accessControlMetadataFactory.create(metastore));
}

protected TransactionalMetadata create(
CatalogName catalogName,
SemiTransactionalHiveMetastore metastore,
HdfsEnvironment hdfsEnvironment,
HivePartitionManager partitionManager,
boolean writesToNonManagedTablesEnabled,
boolean createsOfNonManagedTablesEnabled,
boolean translateHiveViews,
boolean hideDeltaLakeTables,
TypeManager typeManager,
LocationService locationService,
JsonCodec<PartitionUpdate> partitionUpdateCodec,
String trinoVersion,
HiveStatisticsProvider hiveStatisticsProvider,
HiveRedirectionsProvider hiveRedirectionsProvider,
HiveMaterializedViewMetadata hiveMaterializedViewMetadata,
AccessControlMetadata accessControlMetadata)
{
return new HiveMetadata(
catalogName,
metastore,
hdfsEnvironment,
partitionManager,
writesToNonManagedTablesEnabled,
createsOfNonManagedTablesEnabled,
translateHiveViews,
hideDeltaLakeTables,
typeManager,
locationService,
partitionUpdateCodec,
trinoVersion,
hiveStatisticsProvider,
hiveRedirectionsProvider,
hiveMaterializedViewMetadata,
accessControlMetadata);
}
}

0 comments on commit f39b4d8

Please sign in to comment.