Search in sources :

Example 1 with SchemaEmulation

use of com.facebook.presto.kudu.schema.SchemaEmulation in project presto by prestodb.

the class KuduModule method createKuduClientSession.

@Singleton
@Provides
KuduClientSession createKuduClientSession(KuduConnectorId connectorId, KuduClientConfig config) {
    requireNonNull(config, "config is null");
    KuduClient client;
    if (!config.isKerberosAuthEnabled()) {
        client = KuduUtil.createKuduClient(config);
    } else {
        KuduUtil.initKerberosENV(config.getKerberosPrincipal(), config.getKerberosKeytab(), config.isKerberosAuthDebugEnabled());
        client = KuduUtil.createKuduKerberosClient(config);
    }
    SchemaEmulation strategy;
    if (config.isSchemaEmulationEnabled()) {
        strategy = new SchemaEmulationByTableNameConvention(config.getSchemaEmulationPrefix());
    } else {
        strategy = new NoSchemaEmulation();
    }
    return new KuduClientSession(connectorId, client, strategy, config.isKerberosAuthEnabled());
}
Also used : SchemaEmulationByTableNameConvention(com.facebook.presto.kudu.schema.SchemaEmulationByTableNameConvention) SchemaEmulation(com.facebook.presto.kudu.schema.SchemaEmulation) NoSchemaEmulation(com.facebook.presto.kudu.schema.NoSchemaEmulation) NoSchemaEmulation(com.facebook.presto.kudu.schema.NoSchemaEmulation) KuduClient(org.apache.kudu.client.KuduClient) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Aggregations

NoSchemaEmulation (com.facebook.presto.kudu.schema.NoSchemaEmulation)1 SchemaEmulation (com.facebook.presto.kudu.schema.SchemaEmulation)1 SchemaEmulationByTableNameConvention (com.facebook.presto.kudu.schema.SchemaEmulationByTableNameConvention)1 Provides (com.google.inject.Provides)1 Singleton (javax.inject.Singleton)1 KuduClient (org.apache.kudu.client.KuduClient)1