Search in sources :

Example 1 with SimpleAddressSqlFunctionExecutorsModule

use of com.facebook.presto.functionNamespace.execution.SimpleAddressSqlFunctionExecutorsModule in project presto by prestodb.

the class MySqlFunctionNamespaceManagerFactory method create.

@Override
public FunctionNamespaceManager<?> create(String catalogName, Map<String, String> config, FunctionNamespaceManagerContext context) {
    try {
        Bootstrap app = new Bootstrap(new MySqlFunctionNamespaceManagerModule(catalogName), new MySqlConnectionModule(), new SimpleAddressSqlFunctionExecutorsModule());
        Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
        return injector.getInstance(MySqlFunctionNamespaceManager.class);
    } catch (Exception e) {
        throwIfUnchecked(e);
        throw new RuntimeException(e);
    }
}
Also used : SimpleAddressSqlFunctionExecutorsModule(com.facebook.presto.functionNamespace.execution.SimpleAddressSqlFunctionExecutorsModule) Injector(com.google.inject.Injector) Bootstrap(com.facebook.airlift.bootstrap.Bootstrap)

Example 2 with SimpleAddressSqlFunctionExecutorsModule

use of com.facebook.presto.functionNamespace.execution.SimpleAddressSqlFunctionExecutorsModule in project presto by prestodb.

the class TestMySqlFunctionNamespaceManager method setup.

@BeforeClass
public void setup() throws Exception {
    this.mySqlServer = new TestingMySqlServer("testuser", "testpass", DB);
    Bootstrap app = new Bootstrap(new MySqlFunctionNamespaceManagerModule(TEST_CATALOG), new SimpleAddressSqlFunctionExecutorsModule(), new DriftNettyClientModule(), new MySqlConnectionModule());
    Map<String, String> config = ImmutableMap.<String, String>builder().put("function-cache-expiration", "0s").put("function-instance-cache-expiration", "0s").put("database-url", mySqlServer.getJdbcUrl(DB)).build();
    try {
        this.injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
        this.functionNamespaceManager = injector.getInstance(MySqlFunctionNamespaceManager.class);
        this.jdbi = injector.getInstance(Jdbi.class);
    } catch (Exception e) {
        throwIfUnchecked(e);
        throw new RuntimeException(e);
    }
}
Also used : SimpleAddressSqlFunctionExecutorsModule(com.facebook.presto.functionNamespace.execution.SimpleAddressSqlFunctionExecutorsModule) Jdbi(org.jdbi.v3.core.Jdbi) TestingMySqlServer(com.facebook.presto.testing.mysql.TestingMySqlServer) DriftNettyClientModule(com.facebook.drift.transport.netty.client.DriftNettyClientModule) Bootstrap(com.facebook.airlift.bootstrap.Bootstrap) PrestoException(com.facebook.presto.spi.PrestoException) UncheckedExecutionException(com.google.common.util.concurrent.UncheckedExecutionException) BeforeClass(org.testng.annotations.BeforeClass)

Example 3 with SimpleAddressSqlFunctionExecutorsModule

use of com.facebook.presto.functionNamespace.execution.SimpleAddressSqlFunctionExecutorsModule in project presto by prestodb.

the class H2FunctionNamespaceManagerFactory method create.

@Override
public FunctionNamespaceManager<?> create(String catalogName, Map<String, String> config, FunctionNamespaceManagerContext context) {
    try {
        Bootstrap app = new Bootstrap(new DriftNettyClientModule(), new MySqlFunctionNamespaceManagerModule(catalogName), new H2ConnectionModule(), new SimpleAddressSqlFunctionExecutorsModule());
        Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
        return injector.getInstance(MySqlFunctionNamespaceManager.class);
    } catch (Exception e) {
        throwIfUnchecked(e);
        throw new RuntimeException(e);
    }
}
Also used : MySqlFunctionNamespaceManagerModule(com.facebook.presto.functionNamespace.mysql.MySqlFunctionNamespaceManagerModule) SimpleAddressSqlFunctionExecutorsModule(com.facebook.presto.functionNamespace.execution.SimpleAddressSqlFunctionExecutorsModule) DriftNettyClientModule(com.facebook.drift.transport.netty.client.DriftNettyClientModule) Injector(com.google.inject.Injector) Bootstrap(com.facebook.airlift.bootstrap.Bootstrap)

Aggregations

Bootstrap (com.facebook.airlift.bootstrap.Bootstrap)3 SimpleAddressSqlFunctionExecutorsModule (com.facebook.presto.functionNamespace.execution.SimpleAddressSqlFunctionExecutorsModule)3 DriftNettyClientModule (com.facebook.drift.transport.netty.client.DriftNettyClientModule)2 Injector (com.google.inject.Injector)2 MySqlFunctionNamespaceManagerModule (com.facebook.presto.functionNamespace.mysql.MySqlFunctionNamespaceManagerModule)1 PrestoException (com.facebook.presto.spi.PrestoException)1 TestingMySqlServer (com.facebook.presto.testing.mysql.TestingMySqlServer)1 UncheckedExecutionException (com.google.common.util.concurrent.UncheckedExecutionException)1 Jdbi (org.jdbi.v3.core.Jdbi)1 BeforeClass (org.testng.annotations.BeforeClass)1