Skip to content

Commit

Permalink
Allow to inject system tables in Hive
Browse files Browse the repository at this point in the history
  • Loading branch information
kokosing committed Jan 15, 2020
1 parent 63c923a commit 7ae1231
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import io.prestosql.spi.connector.ConnectorPageSinkProvider;
import io.prestosql.spi.connector.ConnectorPageSourceProvider;
import io.prestosql.spi.connector.ConnectorSplitManager;
import io.prestosql.spi.connector.SystemTable;
import io.prestosql.spi.type.Type;
import io.prestosql.spi.type.TypeId;
import io.prestosql.spi.type.TypeManager;
Expand Down Expand Up @@ -130,6 +131,8 @@ public void configure(Binder binder)
configBinder(binder).bindConfig(ParquetWriterConfig.class);

jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class);

newSetBinder(binder, SystemTable.class);
}

@ForHive
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*/
package io.prestosql.plugin.hive;

import com.google.common.collect.ImmutableSet;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.TypeLiteral;
Expand Down Expand Up @@ -41,6 +40,7 @@
import io.prestosql.spi.connector.ConnectorPageSinkProvider;
import io.prestosql.spi.connector.ConnectorPageSourceProvider;
import io.prestosql.spi.connector.ConnectorSplitManager;
import io.prestosql.spi.connector.SystemTable;
import io.prestosql.spi.connector.classloader.ClassLoaderSafeConnectorAccessControl;
import io.prestosql.spi.connector.classloader.ClassLoaderSafeConnectorPageSinkProvider;
import io.prestosql.spi.connector.classloader.ClassLoaderSafeConnectorPageSourceProvider;
Expand Down Expand Up @@ -109,6 +109,7 @@ public static Connector createConnector(String catalogName, Map<String, String>
new SystemTableAwareAccessControl(injector.getInstance(ConnectorAccessControl.class)),
classLoader);
Set<Procedure> procedures = injector.getInstance(Key.get(new TypeLiteral<Set<Procedure>>() {}));
Set<SystemTable> systemTables = injector.getInstance(Key.get(new TypeLiteral<Set<SystemTable>>() {}));

return new HiveConnector(
lifeCycleManager,
Expand All @@ -118,7 +119,7 @@ public static Connector createConnector(String catalogName, Map<String, String>
new ClassLoaderSafeConnectorPageSourceProvider(connectorPageSource, classLoader),
new ClassLoaderSafeConnectorPageSinkProvider(pageSinkProvider, classLoader),
new ClassLoaderSafeNodePartitioningProvider(connectorDistributionProvider, classLoader),
ImmutableSet.of(),
systemTables,
procedures,
hiveSessionProperties.getSessionProperties(),
HiveSchemaProperties.SCHEMA_PROPERTIES,
Expand Down

0 comments on commit 7ae1231

Please sign in to comment.