public static SchemaPlus createRootSchema( final DruidSchema druidSchema, final SystemSchema systemSchema, final AuthorizerMapper authorizerMapper ) { final SchemaPlus rootSchema = CalciteSchema.createRootSchema(false, false).plus(); rootSchema.add(DruidSchema.NAME, druidSchema); rootSchema.add(InformationSchema.NAME, new InformationSchema(rootSchema, authorizerMapper)); rootSchema.add(SystemSchema.NAME, systemSchema); return rootSchema; }
public SchemaPlus getRootSchema() { return rootSchema.plus(); }
private static Function<Class, Expression> getClassExpressionFunction( CalciteSchema.TableEntry tableEntry, Table table) { return getClassExpressionFunction(tableEntry.schema.plus(), tableEntry.name, table); }
/** * Creates a root schema. * * @param addMetadataSchema Whether to add "metadata" schema containing * definitions of tables, columns etc. */ public static SchemaPlus createRootSchema(boolean addMetadataSchema) { return CalciteSchema.createRootSchema(addMetadataSchema).plus(); }
/** * Creates a root schema. * * @param addMetadataSchema Whether to add "metadata" schema containing * definitions of tables, columns etc. */ public static SchemaPlus createRootSchema(boolean addMetadataSchema) { return CalciteSchema.createRootSchema(addMetadataSchema).plus(); }
public SchemaPlus getSubSchema(String name) { final CalciteSchema subSchema = CalciteSchema.this.getSubSchema(name, true); return subSchema == null ? null : subSchema.plus(); }
public SchemaPlus getSubSchema(String name) { final CalciteSchema subSchema = CalciteSchema.this.getSubSchema(name, true); return subSchema == null ? null : subSchema.plus(); }
private static Function<Class, Expression> getClassExpressionFunction( CalciteSchema.TableEntry tableEntry, Table table) { return getClassExpressionFunction(tableEntry.schema.plus(), tableEntry.name, table); }
public SchemaPlus add(String name, Schema schema) { final CalciteSchema calciteSchema = CalciteSchema.this.add(name, schema); return calciteSchema.plus(); }
public SchemaPlus add(String name, Schema schema) { final CalciteSchema calciteSchema = CalciteSchema.this.add(name, schema); return calciteSchema.plus(); }
private ImmutableSet<DataSourceSchema> getDrivers(CalciteSchema tableSchema) { final ImmutableSet.Builder<DataSourceSchema> dsBuilder = new ImmutableSet.Builder<>(); SchemaPlus tableSchemaPlus = tableSchema.plus(); while (tableSchemaPlus != null) { Schema schema = CalciteSchema.from(tableSchemaPlus).schema; if (schema instanceof DataSourceSchema) { dsBuilder.add((DataSourceSchema) schema); } tableSchemaPlus = tableSchemaPlus.getParentSchema(); } return dsBuilder.build(); }
public Iterator<Object> iterator() { final DataContext dataContext = Schemas.createDataContext(connection, calciteSignature.rootSchema.plus()); return calciteSignature.enumerable(dataContext).iterator(); } });
public Enumerator<Object> enumerator() { final DataContext dataContext = Schemas.createDataContext(connection, calciteSignature.rootSchema.plus()); return calciteSignature.enumerable(dataContext).enumerator(); }
public Iterator<Object> iterator() { final DataContext dataContext = Schemas.createDataContext(connection, calciteSignature.rootSchema.plus()); return calciteSignature.enumerable(dataContext).iterator(); } });
public Enumerator<Object> enumerator() { final DataContext dataContext = Schemas.createDataContext(connection, calciteSignature.rootSchema.plus()); return calciteSignature.enumerable(dataContext).enumerator(); }
public R apply(RelOptCluster cluster, RelOptSchema relOptSchema, SchemaPlus rootSchema, CalciteServerStatement statement) { final CalciteSchema schema = CalciteSchema.from( Util.first(config.getDefaultSchema(), rootSchema)); return action.apply(cluster, relOptSchema, schema.root().plus()); } });
public R apply(RelOptCluster cluster, RelOptSchema relOptSchema, SchemaPlus rootSchema, CalciteServerStatement statement) { final CalciteSchema schema = CalciteSchema.from( Util.first(config.getDefaultSchema(), rootSchema)); return action.apply(cluster, relOptSchema, schema.root().plus()); } });
public static SchemaPlus createRootSchema( final DruidSchema druidSchema, final SystemSchema systemSchema, final AuthorizerMapper authorizerMapper ) { final SchemaPlus rootSchema = CalciteSchema.createRootSchema(false, false).plus(); rootSchema.add(DruidSchema.NAME, druidSchema); rootSchema.add(InformationSchema.NAME, new InformationSchema(rootSchema, authorizerMapper)); rootSchema.add(SystemSchema.NAME, systemSchema); return rootSchema; }
/** Wraps the SQL string in a * {@link org.apache.calcite.jdbc.CalcitePrepare.Query} object, giving the * {@link Hook#STRING_TO_QUERY} hook chance to override. */ private CalcitePrepare.Query<Object> toQuery( Context context, String sql) { final Holder<CalcitePrepare.Query<Object>> queryHolder = Holder.of(CalcitePrepare.Query.of(sql)); final FrameworkConfig config = Frameworks.newConfigBuilder() .parserConfig(SqlParser.Config.DEFAULT) .defaultSchema(context.getRootSchema().plus()) .build(); Hook.STRING_TO_QUERY.run(Pair.of(config, queryHolder)); return queryHolder.get(); }
/** Wraps the SQL string in a * {@link org.apache.calcite.jdbc.CalcitePrepare.Query} object, giving the * {@link Hook#STRING_TO_QUERY} hook chance to override. */ private CalcitePrepare.Query<Object> toQuery( Context context, String sql) { final Holder<CalcitePrepare.Query<Object>> queryHolder = Holder.of(CalcitePrepare.Query.of(sql)); final FrameworkConfig config = Frameworks.newConfigBuilder() .parserConfig(SqlParser.Config.DEFAULT) .defaultSchema(context.getRootSchema().plus()) .build(); Hook.STRING_TO_QUERY.run(Pair.of(config, queryHolder)); return queryHolder.get(); }