Search in sources :

Example 1 with SessionPropertyConfigurationManagerFactory

use of com.facebook.presto.spi.session.SessionPropertyConfigurationManagerFactory in project presto by prestodb.

the class PluginManager method installPlugin.

public void installPlugin(Plugin plugin) {
    for (BlockEncoding blockEncoding : plugin.getBlockEncodings()) {
        log.info("Registering block encoding %s", blockEncoding.getName());
        blockEncodingManager.addBlockEncoding(blockEncoding);
    }
    for (Type type : plugin.getTypes()) {
        log.info("Registering type %s", type.getTypeSignature());
        metadata.getFunctionAndTypeManager().addType(type);
    }
    for (ParametricType parametricType : plugin.getParametricTypes()) {
        log.info("Registering parametric type %s", parametricType.getName());
        metadata.getFunctionAndTypeManager().addParametricType(parametricType);
    }
    for (ConnectorFactory connectorFactory : plugin.getConnectorFactories()) {
        if (disabledConnectors.contains(connectorFactory.getName())) {
            log.info("Skipping disabled connector %s", connectorFactory.getName());
            continue;
        }
        log.info("Registering connector %s", connectorFactory.getName());
        connectorManager.addConnectorFactory(connectorFactory);
    }
    for (Class<?> functionClass : plugin.getFunctions()) {
        log.info("Registering functions from %s", functionClass.getName());
        metadata.registerBuiltInFunctions(extractFunctions(functionClass));
    }
    for (FunctionNamespaceManagerFactory functionNamespaceManagerFactory : plugin.getFunctionNamespaceManagerFactories()) {
        log.info("Registering function namespace manager %s", functionNamespaceManagerFactory.getName());
        metadata.getFunctionAndTypeManager().addFunctionNamespaceFactory(functionNamespaceManagerFactory);
    }
    for (SessionPropertyConfigurationManagerFactory sessionConfigFactory : plugin.getSessionPropertyConfigurationManagerFactories()) {
        log.info("Registering session property configuration manager %s", sessionConfigFactory.getName());
        sessionPropertyDefaults.addConfigurationManagerFactory(sessionConfigFactory);
    }
    for (ResourceGroupConfigurationManagerFactory configurationManagerFactory : plugin.getResourceGroupConfigurationManagerFactories()) {
        log.info("Registering resource group configuration manager %s", configurationManagerFactory.getName());
        resourceGroupManager.addConfigurationManagerFactory(configurationManagerFactory);
    }
    for (SystemAccessControlFactory accessControlFactory : plugin.getSystemAccessControlFactories()) {
        log.info("Registering system access control %s", accessControlFactory.getName());
        accessControlManager.addSystemAccessControlFactory(accessControlFactory);
    }
    for (PasswordAuthenticatorFactory authenticatorFactory : plugin.getPasswordAuthenticatorFactories()) {
        log.info("Registering password authenticator %s", authenticatorFactory.getName());
        passwordAuthenticatorManager.addPasswordAuthenticatorFactory(authenticatorFactory);
    }
    for (EventListenerFactory eventListenerFactory : plugin.getEventListenerFactories()) {
        log.info("Registering event listener %s", eventListenerFactory.getName());
        eventListenerManager.addEventListenerFactory(eventListenerFactory);
    }
    for (TempStorageFactory tempStorageFactory : plugin.getTempStorageFactories()) {
        log.info("Registering temp storage %s", tempStorageFactory.getName());
        tempStorageManager.addTempStorageFactory(tempStorageFactory);
    }
    for (QueryPrerequisitesFactory queryPrerequisitesFactory : plugin.getQueryPrerequisitesFactories()) {
        log.info("Registering query prerequisite factory %s", queryPrerequisitesFactory.getName());
        queryPrerequisitesManager.addQueryPrerequisitesFactory(queryPrerequisitesFactory);
    }
    for (NodeTtlFetcherFactory nodeTtlFetcherFactory : plugin.getNodeTtlFetcherFactories()) {
        log.info("Registering Ttl fetcher factory %s", nodeTtlFetcherFactory.getName());
        nodeTtlFetcherManager.addNodeTtlFetcherFactory(nodeTtlFetcherFactory);
    }
    for (ClusterTtlProviderFactory clusterTtlProviderFactory : plugin.getClusterTtlProviderFactories()) {
        log.info("Registering Cluster Ttl provider factory %s", clusterTtlProviderFactory.getName());
        clusterTtlProviderManager.addClusterTtlProviderFactory(clusterTtlProviderFactory);
    }
}
Also used : NodeTtlFetcherFactory(com.facebook.presto.spi.ttl.NodeTtlFetcherFactory) ResourceGroupConfigurationManagerFactory(com.facebook.presto.spi.resourceGroups.ResourceGroupConfigurationManagerFactory) ClusterTtlProviderFactory(com.facebook.presto.spi.ttl.ClusterTtlProviderFactory) EventListenerFactory(com.facebook.presto.spi.eventlistener.EventListenerFactory) QueryPrerequisitesFactory(com.facebook.presto.spi.prerequisites.QueryPrerequisitesFactory) SystemAccessControlFactory(com.facebook.presto.spi.security.SystemAccessControlFactory) ParametricType(com.facebook.presto.common.type.ParametricType) Type(com.facebook.presto.common.type.Type) PasswordAuthenticatorFactory(com.facebook.presto.spi.security.PasswordAuthenticatorFactory) ConnectorFactory(com.facebook.presto.spi.connector.ConnectorFactory) ParametricType(com.facebook.presto.common.type.ParametricType) FunctionNamespaceManagerFactory(com.facebook.presto.spi.function.FunctionNamespaceManagerFactory) TempStorageFactory(com.facebook.presto.spi.storage.TempStorageFactory) SessionPropertyConfigurationManagerFactory(com.facebook.presto.spi.session.SessionPropertyConfigurationManagerFactory) BlockEncoding(com.facebook.presto.common.block.BlockEncoding)

Example 2 with SessionPropertyConfigurationManagerFactory

use of com.facebook.presto.spi.session.SessionPropertyConfigurationManagerFactory in project presto by prestodb.

the class SessionPropertyDefaults method setConfigurationManager.

@VisibleForTesting
public void setConfigurationManager(String configManagerName, Map<String, String> properties) {
    log.info("-- Loading session property configuration manager --");
    SessionPropertyConfigurationManagerFactory factory = factories.get(configManagerName);
    checkState(factory != null, "Session property configuration manager '%s' is not registered", configManagerName);
    SessionPropertyConfigurationManager manager = factory.create(properties, configurationManagerContext);
    checkState(delegate.compareAndSet(null, manager), "sessionPropertyConfigurationManager is already set");
    log.info("-- Loaded session property configuration manager %s --", configManagerName);
}
Also used : SessionPropertyConfigurationManagerFactory(com.facebook.presto.spi.session.SessionPropertyConfigurationManagerFactory) SessionPropertyConfigurationManager(com.facebook.presto.spi.session.SessionPropertyConfigurationManager) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 3 with SessionPropertyConfigurationManagerFactory

use of com.facebook.presto.spi.session.SessionPropertyConfigurationManagerFactory in project presto by prestodb.

the class TestSessionPropertyDefaults method testApplyDefaultProperties.

@Test
public void testApplyDefaultProperties() {
    SessionPropertyDefaults sessionPropertyDefaults = new SessionPropertyDefaults(TEST_NODE_INFO);
    SessionPropertyConfigurationManagerFactory factory = new TestingSessionPropertyConfigurationManagerFactory(new SystemSessionPropertyConfiguration(ImmutableMap.<String, String>builder().put(QUERY_MAX_MEMORY, "override").put("system_default", "system_default").build(), ImmutableMap.of("override", "overridden")), ImmutableMap.of("testCatalog", ImmutableMap.<String, String>builder().put("explicit_set", "override").put("catalog_default", "catalog_default").build()));
    sessionPropertyDefaults.addConfigurationManagerFactory(factory);
    sessionPropertyDefaults.setConfigurationManager(factory.getName(), ImmutableMap.of());
    Session session = Session.builder(new SessionPropertyManager()).setQueryId(new QueryId("test_query_id")).setIdentity(new Identity("testUser", Optional.empty())).setSystemProperty(QUERY_MAX_MEMORY, "1GB").setSystemProperty(JOIN_DISTRIBUTION_TYPE, "partitioned").setSystemProperty(HASH_PARTITION_COUNT, "43").setSystemProperty("override", "should be overridden").setCatalogSessionProperty("testCatalog", "explicit_set", "explicit_set").build();
    assertEquals(session.getSystemProperties(), ImmutableMap.<String, String>builder().put(QUERY_MAX_MEMORY, "1GB").put(JOIN_DISTRIBUTION_TYPE, "partitioned").put(HASH_PARTITION_COUNT, "43").put("override", "should be overridden").build());
    assertEquals(session.getUnprocessedCatalogProperties(), ImmutableMap.of("testCatalog", ImmutableMap.<String, String>builder().put("explicit_set", "explicit_set").build()));
    session = sessionPropertyDefaults.newSessionWithDefaultProperties(session, Optional.empty(), Optional.of(TEST_RESOURCE_GROUP_ID));
    assertEquals(session.getSystemProperties(), ImmutableMap.<String, String>builder().put(QUERY_MAX_MEMORY, "1GB").put(JOIN_DISTRIBUTION_TYPE, "partitioned").put(HASH_PARTITION_COUNT, "43").put("system_default", "system_default").put("override", "overridden").build());
    assertEquals(session.getUnprocessedCatalogProperties(), ImmutableMap.of("testCatalog", ImmutableMap.<String, String>builder().put("explicit_set", "explicit_set").put("catalog_default", "catalog_default").build()));
}
Also used : SystemSessionPropertyConfiguration(com.facebook.presto.spi.session.SessionPropertyConfigurationManager.SystemSessionPropertyConfiguration) QueryId(com.facebook.presto.spi.QueryId) TestingSessionPropertyConfigurationManagerFactory(com.facebook.presto.spi.session.TestingSessionPropertyConfigurationManagerFactory) SessionPropertyManager(com.facebook.presto.metadata.SessionPropertyManager) SessionPropertyConfigurationManagerFactory(com.facebook.presto.spi.session.SessionPropertyConfigurationManagerFactory) TestingSessionPropertyConfigurationManagerFactory(com.facebook.presto.spi.session.TestingSessionPropertyConfigurationManagerFactory) Identity(com.facebook.presto.spi.security.Identity) Session(com.facebook.presto.Session) Test(org.testng.annotations.Test)

Aggregations

SessionPropertyConfigurationManagerFactory (com.facebook.presto.spi.session.SessionPropertyConfigurationManagerFactory)3 Session (com.facebook.presto.Session)1 BlockEncoding (com.facebook.presto.common.block.BlockEncoding)1 ParametricType (com.facebook.presto.common.type.ParametricType)1 Type (com.facebook.presto.common.type.Type)1 SessionPropertyManager (com.facebook.presto.metadata.SessionPropertyManager)1 QueryId (com.facebook.presto.spi.QueryId)1 ConnectorFactory (com.facebook.presto.spi.connector.ConnectorFactory)1 EventListenerFactory (com.facebook.presto.spi.eventlistener.EventListenerFactory)1 FunctionNamespaceManagerFactory (com.facebook.presto.spi.function.FunctionNamespaceManagerFactory)1 QueryPrerequisitesFactory (com.facebook.presto.spi.prerequisites.QueryPrerequisitesFactory)1 ResourceGroupConfigurationManagerFactory (com.facebook.presto.spi.resourceGroups.ResourceGroupConfigurationManagerFactory)1 Identity (com.facebook.presto.spi.security.Identity)1 PasswordAuthenticatorFactory (com.facebook.presto.spi.security.PasswordAuthenticatorFactory)1 SystemAccessControlFactory (com.facebook.presto.spi.security.SystemAccessControlFactory)1 SessionPropertyConfigurationManager (com.facebook.presto.spi.session.SessionPropertyConfigurationManager)1 SystemSessionPropertyConfiguration (com.facebook.presto.spi.session.SessionPropertyConfigurationManager.SystemSessionPropertyConfiguration)1 TestingSessionPropertyConfigurationManagerFactory (com.facebook.presto.spi.session.TestingSessionPropertyConfigurationManagerFactory)1 TempStorageFactory (com.facebook.presto.spi.storage.TempStorageFactory)1 ClusterTtlProviderFactory (com.facebook.presto.spi.ttl.ClusterTtlProviderFactory)1