use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus in project druid by druid-io.
the class DruidAvaticaHandlerTest method setUp.
@Before
public void setUp() throws Exception {
Calcites.setSystemProperties();
walker = CalciteTests.createMockWalker(temporaryFolder.newFolder());
final PlannerConfig plannerConfig = new PlannerConfig();
final SchemaPlus rootSchema = Calcites.createRootSchema(CalciteTests.createMockSchema(walker, plannerConfig));
final DruidOperatorTable operatorTable = CalciteTests.createOperatorTable();
final DruidAvaticaHandler handler = new DruidAvaticaHandler(new DruidMeta(new PlannerFactory(rootSchema, walker, operatorTable, plannerConfig), AVATICA_CONFIG), new DruidNode("dummy", "dummy", 1), new AvaticaMonitor());
final int port = new Random().nextInt(9999) + 10000;
server = new Server(new InetSocketAddress("127.0.0.1", port));
server.setHandler(handler);
server.start();
final String url = String.format("jdbc:avatica:remote:url=http://127.0.0.1:%d%s", port, DruidAvaticaHandler.AVATICA_PATH);
client = DriverManager.getConnection(url);
final Properties propertiesLosAngeles = new Properties();
propertiesLosAngeles.setProperty("sqlTimeZone", "America/Los_Angeles");
clientLosAngeles = DriverManager.getConnection(url, propertiesLosAngeles);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus in project druid by druid-io.
the class DruidStatementTest method setUp.
@Before
public void setUp() throws Exception {
Calcites.setSystemProperties();
walker = CalciteTests.createMockWalker(temporaryFolder.newFolder());
final PlannerConfig plannerConfig = new PlannerConfig();
final SchemaPlus rootSchema = Calcites.createRootSchema(CalciteTests.createMockSchema(walker, plannerConfig));
final DruidOperatorTable operatorTable = CalciteTests.createOperatorTable();
plannerFactory = new PlannerFactory(rootSchema, walker, operatorTable, plannerConfig);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus in project druid by druid-io.
the class CalciteQueryTest method getResults.
private List<Object[]> getResults(final PlannerContext plannerContext, final String sql) throws Exception {
final PlannerConfig plannerConfig = plannerContext.getPlannerConfig();
final DruidSchema druidSchema = CalciteTests.createMockSchema(walker, plannerConfig);
final SchemaPlus rootSchema = Calcites.createRootSchema(druidSchema);
final DruidOperatorTable operatorTable = CalciteTests.createOperatorTable();
final PlannerFactory plannerFactory = new PlannerFactory(rootSchema, walker, operatorTable, plannerConfig);
try (DruidPlanner planner = plannerFactory.createPlanner(plannerContext.getQueryContext())) {
final PlannerResult plan = planner.plan(sql);
return Sequences.toList(plan.run(), Lists.<Object[]>newArrayList());
}
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus in project drill by apache.
the class SchemaTreeProvider method close.
@Override
public void close() throws Exception {
List<AutoCloseable> toClose = Lists.newArrayList();
for (SchemaPlus tree : schemaTreesToClose) {
addSchemasToCloseList(tree, toClose);
}
AutoCloseables.close(toClose);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus in project drill by apache.
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);
}
Aggregations