private synchronized void addConnectorInternal(MaterializedConnector connector) { checkState(!stopped.get(), "ConnectorManager is stopped"); ConnectorId connectorId = connector.getConnectorId(); checkState(!connectors.containsKey(connectorId), "A connector %s already exists", connectorId); connectors.put(connectorId, connector); splitManager.addConnectorSplitManager(connectorId, connector.getSplitManager()); pageSourceManager.addConnectorPageSourceProvider(connectorId, connector.getPageSourceProvider()); connector.getPageSinkProvider() .ifPresent(pageSinkProvider -> pageSinkManager.addConnectorPageSinkProvider(connectorId, pageSinkProvider)); connector.getIndexProvider() .ifPresent(indexProvider -> indexManager.addIndexProvider(connectorId, indexProvider)); connector.getPartitioningProvider() .ifPresent(partitioningProvider -> nodePartitioningManager.addPartitioningProvider(connectorId, partitioningProvider)); metadataManager.getProcedureRegistry().addProcedures(connectorId, connector.getProcedures()); connector.getAccessControl() .ifPresent(accessControl -> accessControlManager.addCatalogAccessControl(connectorId, accessControl)); metadataManager.getTablePropertyManager().addProperties(connectorId, connector.getTableProperties()); metadataManager.getColumnPropertyManager().addProperties(connectorId, connector.getColumnProperties()); metadataManager.getSchemaPropertyManager().addProperties(connectorId, connector.getSchemaProperties()); metadataManager.getSessionPropertyManager().addConnectorSessionProperties(connectorId, connector.getSessionProperties()); }
sessionPropertyManager.addConnectorSessionProperties(bogusTestingCatalog.getConnectorId(), TEST_CATALOG_PROPERTIES);
public StandaloneQueryRunner(Session defaultSession) throws Exception { requireNonNull(defaultSession, "defaultSession is null"); try { server = createTestingPrestoServer(); } catch (Exception e) { close(); throw e; } this.prestoClient = new TestingPrestoClient(server, defaultSession); refreshNodes(); server.getMetadata().addFunctions(AbstractTestQueries.CUSTOM_FUNCTIONS); SessionPropertyManager sessionPropertyManager = server.getMetadata().getSessionPropertyManager(); sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES); sessionPropertyManager.addConnectorSessionProperties(new ConnectorId("catalog"), TEST_CATALOG_PROPERTIES); }
private static LocalQueryRunner createLocalQueryRunner() { Session defaultSession = testSessionBuilder() .setCatalog("local") .setSchema(TINY_SCHEMA_NAME) .build(); LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession); // add the tpch catalog // local queries run directly against the generator localQueryRunner.createCatalog( defaultSession.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of()); localQueryRunner.getMetadata().addFunctions(CUSTOM_FUNCTIONS); SessionPropertyManager sessionPropertyManager = localQueryRunner.getMetadata().getSessionPropertyManager(); sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES); sessionPropertyManager.addConnectorSessionProperties(new ConnectorId(TESTING_CATALOG), TEST_CATALOG_PROPERTIES); return localQueryRunner; }
public static LocalQueryRunner createLocalQueryRunner() { Session defaultSession = testSessionBuilder() .setCatalog("local") .setSchema(TINY_SCHEMA_NAME) .setSystemProperty(PUSH_PARTIAL_AGGREGATION_THROUGH_JOIN, "true") .build(); LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession); // add the tpch catalog // local queries run directly against the generator localQueryRunner.createCatalog( defaultSession.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of()); localQueryRunner.getMetadata().addFunctions(CUSTOM_FUNCTIONS); SessionPropertyManager sessionPropertyManager = localQueryRunner.getMetadata().getSessionPropertyManager(); sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES); sessionPropertyManager.addConnectorSessionProperties(new ConnectorId(TESTING_CATALOG), TEST_CATALOG_PROPERTIES); return localQueryRunner; }
public TestResetSessionTask() { CatalogManager catalogManager = new CatalogManager(); transactionManager = createTestTransactionManager(catalogManager); accessControl = new AllowAllAccessControl(); metadata = new MetadataManager( new FeaturesConfig(), new TypeRegistry(), new BlockEncodingManager(new TypeRegistry()), new SessionPropertyManager(), new SchemaPropertyManager(), new TablePropertyManager(), new ColumnPropertyManager(), transactionManager); metadata.getSessionPropertyManager().addSystemSessionProperty(stringProperty( "foo", "test property", null, false)); Catalog bogusTestingCatalog = createBogusTestingCatalog(CATALOG_NAME); metadata.getSessionPropertyManager().addConnectorSessionProperties(bogusTestingCatalog.getConnectorId(), ImmutableList.of(stringProperty( "baz", "test property", null, false))); catalogManager.registerCatalog(bogusTestingCatalog); }
value -> value)); metadata.getSessionPropertyManager().addConnectorSessionProperties(bogusTestingCatalog.getConnectorId(), sessionProperties);
sessionPropertyManager.addConnectorSessionProperties(bogusTestingCatalog.getConnectorId(), TEST_CATALOG_PROPERTIES);
public TestResetSessionTask() { metadata.getSessionPropertyManager().addSystemSessionProperty(stringSessionProperty( "foo", "test property", null, false)); metadata.getSessionPropertyManager().addConnectorSessionProperties("catalog", ImmutableList.of(stringSessionProperty( "baz", "test property", null, false))); }
public TestSetSessionTask() { metadata.getSessionPropertyManager().addSystemSessionProperty(stringSessionProperty( "foo", "test property", null, false)); metadata.getSessionPropertyManager().addConnectorSessionProperties("foo", ImmutableList.of(stringSessionProperty( "bar", "test property", null, false))); }
public StandaloneQueryRunner(Session defaultSession) throws Exception { requireNonNull(defaultSession, "defaultSession is null"); try { server = createTestingPrestoServer(); } catch (Exception e) { close(); throw e; } this.prestoClient = new TestingPrestoClient(server, defaultSession); refreshNodes(); server.getMetadata().addFunctions(AbstractTestQueries.CUSTOM_FUNCTIONS); SessionPropertyManager sessionPropertyManager = server.getMetadata().getSessionPropertyManager(); sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES); sessionPropertyManager.addConnectorSessionProperties(new ConnectorId("catalog"), TEST_CATALOG_PROPERTIES); }
private synchronized void addCatalogConnector(String catalogName, String connectorId, ConnectorFactory factory, Map<String, String> properties) { Connector connector = createConnector(connectorId, factory, properties); addConnectorInternal(ConnectorType.STANDARD, catalogName, connectorId, connector); String informationSchemaId = makeInformationSchemaConnectorId(connectorId); addConnectorInternal(ConnectorType.INFORMATION_SCHEMA, catalogName, informationSchemaId, new InformationSchemaConnector(catalogName, nodeManager, metadataManager)); String systemId = makeSystemTablesConnectorId(connectorId); addConnectorInternal(ConnectorType.SYSTEM, catalogName, systemId, new SystemConnector( systemId, nodeManager, connector.getSystemTables(), transactionId -> transactionManager.getConnectorTransaction(transactionId, connectorId))); // Register session and table properties once per catalog metadataManager.getSessionPropertyManager().addConnectorSessionProperties(catalogName, connector.getSessionProperties()); metadataManager.getTablePropertyManager().addTableProperties(catalogName, connector.getTableProperties()); }
private static LocalQueryRunner createLocalQueryRunner() { Session defaultSession = testSessionBuilder() .setCatalog("local") .setSchema(TINY_SCHEMA_NAME) .build(); LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession); // add the tpch catalog // local queries run directly against the generator localQueryRunner.createCatalog( defaultSession.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of()); localQueryRunner.getMetadata().addFunctions(CUSTOM_FUNCTIONS); SessionPropertyManager sessionPropertyManager = localQueryRunner.getMetadata().getSessionPropertyManager(); sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES); sessionPropertyManager.addConnectorSessionProperties(new ConnectorId(TESTING_CATALOG), TEST_CATALOG_PROPERTIES); return localQueryRunner; }
private static LocalQueryRunner createLocalQueryRunner() { Session defaultSession = testSessionBuilder() .setCatalog("local") .setSchema(TINY_SCHEMA_NAME) .build(); LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession); // add the tpch catalog // local queries run directly against the generator localQueryRunner.createCatalog( defaultSession.getCatalog().get(), new TpchConnectorFactory(localQueryRunner.getNodeManager(), 1), ImmutableMap.<String, String>of()); localQueryRunner.createCatalog(TPCH_SAMPLED_SCHEMA, new SampledTpchConnectorFactory(localQueryRunner.getNodeManager(), 1, 2), ImmutableMap.<String, String>of()); localQueryRunner.getMetadata().addFunctions(CUSTOM_FUNCTIONS); SessionPropertyManager sessionPropertyManager = localQueryRunner.getMetadata().getSessionPropertyManager(); sessionPropertyManager.addSystemSessionProperties(AbstractTestQueries.TEST_SYSTEM_PROPERTIES); sessionPropertyManager.addConnectorSessionProperties("connector", AbstractTestQueries.TEST_CATALOG_PROPERTIES); return localQueryRunner; }
public static LocalQueryRunner createLocalQueryRunner() { Session defaultSession = testSessionBuilder() .setCatalog("local") .setSchema(TINY_SCHEMA_NAME) .setSystemProperty(PUSH_PARTIAL_AGGREGATION_THROUGH_JOIN, "true") .build(); LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession); // add the tpch catalog // local queries run directly against the generator localQueryRunner.createCatalog( defaultSession.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of()); localQueryRunner.getMetadata().addFunctions(CUSTOM_FUNCTIONS); SessionPropertyManager sessionPropertyManager = localQueryRunner.getMetadata().getSessionPropertyManager(); sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES); sessionPropertyManager.addConnectorSessionProperties(new ConnectorId(TESTING_CATALOG), TEST_CATALOG_PROPERTIES); return localQueryRunner; }