use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus in project drill by axbaretto.
the class JdbcStoragePlugin method registerSchemas.
@Override
public void registerSchemas(SchemaConfig config, SchemaPlus parent) {
JdbcCatalogSchema schema = new JdbcCatalogSchema(name);
SchemaPlus holder = parent.add(name, schema);
schema.setHolder(holder);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus in project drill by axbaretto.
the class HiveSchemaFactory method registerSchemas.
@Override
public void registerSchemas(SchemaConfig schemaConfig, SchemaPlus parent) throws IOException {
DrillHiveMetaStoreClient mClientForSchemaTree = processUserMetastoreClient;
if (isDrillImpersonationEnabled) {
try {
mClientForSchemaTree = metaStoreClientLoadingCache.get(schemaConfig.getUserName());
} catch (final ExecutionException e) {
throw new IOException("Failure setting up Hive metastore client.", e);
}
}
HiveSchema schema = new HiveSchema(schemaConfig, mClientForSchemaTree, schemaName);
SchemaPlus hPlus = parent.add(schemaName, schema);
schema.setHolder(hPlus);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus in project drill by axbaretto.
the class KuduSchemaFactory method registerSchemas.
@Override
public void registerSchemas(SchemaConfig schemaConfig, SchemaPlus parent) throws IOException {
KuduTables schema = new KuduTables(schemaName);
SchemaPlus hPlus = parent.add(schemaName, schema);
schema.setHolder(hPlus);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus in project drill by axbaretto.
the class SchemaUtilites method getTemporaryWorkspace.
/**
* Looks in schema tree for default temporary workspace instance.
*
* @param defaultSchema default schema
* @param config drill config
* @return default temporary workspace, null if workspace was not found
*/
public static AbstractSchema getTemporaryWorkspace(SchemaPlus defaultSchema, DrillConfig config) {
String temporarySchema = config.getString(ExecConstants.DEFAULT_TEMPORARY_WORKSPACE);
List<String> temporarySchemaPath = Lists.newArrayList(temporarySchema);
SchemaPlus schema = findSchema(defaultSchema, temporarySchemaPath);
return schema == null ? null : unwrapAsDrillSchemaInstance(schema);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus in project drill by axbaretto.
the class DescribeSchemaHandler method getPlan.
@Override
public PhysicalPlan getPlan(SqlNode sqlNode) {
SqlIdentifier schema = ((SqlDescribeSchema) sqlNode).getSchema();
SchemaPlus drillSchema = SchemaUtilites.findSchema(config.getConverter().getDefaultSchema(), schema.names);
if (drillSchema != null) {
StoragePlugin storagePlugin;
try {
storagePlugin = context.getStorage().getPlugin(schema.names.get(0));
} catch (ExecutionSetupException e) {
throw new DrillRuntimeException("Failure while retrieving storage plugin", e);
}
String properties;
try {
final Map configMap = mapper.convertValue(storagePlugin.getConfig(), Map.class);
if (storagePlugin instanceof FileSystemPlugin) {
transformWorkspaces(schema.names, configMap);
}
properties = mapper.writeValueAsString(configMap);
} catch (JsonProcessingException e) {
throw new DrillRuntimeException("Error while trying to convert storage config to json string", e);
}
return DirectPlan.createDirectPlan(context, new DescribeSchemaResult(Joiner.on(".").join(schema.names), properties));
}
throw UserException.validationError().message(String.format("Invalid schema name [%s]", Joiner.on(".").join(schema.names))).build(logger);
}
Aggregations