本文整理汇总了Java中org.apache.calcite.schema.Schemas类的典型用法代码示例。如果您正苦于以下问题:Java Schemas类的具体用法?Java Schemas怎么用?Java Schemas使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Schemas类属于org.apache.calcite.schema包,在下文中一共展示了Schemas类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: create
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
public static JournalledJdbcSchema create(
SchemaPlus parentSchema,
String name,
Map<String, Object> operand
) {
DataSource dataSource;
try {
dataSource = parseDataSource(operand);
} catch (Exception e) {
throw new IllegalArgumentException("Error while reading dataSource", e);
}
String catalog = (String) operand.get("jdbcCatalog");
String schema = (String) operand.get("jdbcSchema");
Expression expression = null;
if (parentSchema != null) {
expression = Schemas.subSchemaExpression(parentSchema, name, JdbcSchema.class);
}
final SqlDialect dialect = createDialect(dataSource);
final JdbcConvention convention = JdbcConvention.of(dialect, expression, name);
return new JournalledJdbcSchema(dataSource, dialect, convention, catalog, schema, operand);
}
开发者ID:tzolov,项目名称:calcite-sql-rewriter,代码行数:22,代码来源:JournalledJdbcSchema.java
示例2: OctopusJdbcDataSource
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
public OctopusJdbcDataSource(SchemaPlus parentSchema, MetaDataSource metaDataSource) {
super(metaDataSource);
LOG.debug("create OctopusJdbcDataSource. dataSourceName: " + metaDataSource.getName());
dataSource = dataSource(metaDataSource.getConnectionString(), metaDataSource.getDriverName());
/* TODO: what is this? */
final Expression expression =
Schemas.subSchemaExpression(parentSchema, getName(), OctopusJdbcSchema.class);
this.dialect = createDialect(dataSource);
this.convention = JdbcConvention.of(dialect, expression, metaDataSource.getName());
ImmutableMap.Builder<String, Schema> builder = ImmutableMap.builder();
for (MetaSchema metaSchema : metaDataSource.getSchemas())
builder.put(metaSchema.getName(), new OctopusJdbcSchema(metaSchema, this));
setSubSchemaMap(builder.build());
}
开发者ID:bitnine-oss,项目名称:octopus,代码行数:19,代码来源:OctopusJdbcDataSource.java
示例3: populateMaterializationsAndLattice
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
private void populateMaterializationsAndLattice(
QuarkMaterializeCluster.RelOptPlannerHolder plannerHolder,
CalciteSchema rootSchema) {
if (materializations == null) {
materializations =
MaterializationService.instance().query(rootSchema);
}
Materializer materializer = new Materializer(materializations);
materializer.populateMaterializations(context.getPrepareContext(), plannerHolder);
List<CalciteSchema.LatticeEntry> lattices = Schemas.getLatticeEntries(rootSchema);
for (CalciteSchema.LatticeEntry lattice : lattices) {
final CalciteSchema.TableEntry starTable = lattice.getStarTable();
final JavaTypeFactory typeFactory = context.getTypeFactory();
final RelOptTableImpl starRelOptTable =
RelOptTableImpl.create(catalogReader,
starTable.getTable().getRowType(typeFactory), starTable, null);
plannerHolder.getPlanner().addLattice(
new RelOptLattice(lattice.getLattice(), starRelOptTable));
}
}
开发者ID:qubole,项目名称:quark,代码行数:24,代码来源:SqlWorker.java
示例4: unwrap
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
public <T> T unwrap(Class<T> clazz) {
if (clazz.isInstance(this)) {
return clazz.cast(this);
}
if (clazz.isInstance(table)) {
return clazz.cast(table);
}
if (table instanceof Wrapper) {
final T t = ((Wrapper) table).unwrap(clazz);
if (t != null) {
return t;
}
}
if (clazz == CalciteSchema.class) {
return clazz.cast(
Schemas.subSchema(((CalciteCatalogReader) schema).rootSchema,
Util.skipLast(getQualifiedName())));
}
return null;
}
开发者ID:apache,项目名称:calcite,代码行数:21,代码来源:RelOptTableImpl.java
示例5: apply
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
public TranslatableTable apply(List<Object> arguments) {
final CalciteConnection connection =
MaterializedViewTable.MATERIALIZATION_CONNECTION;
CalcitePrepare.AnalyzeViewResult parsed =
Schemas.analyzeView(connection, schema, schemaPath, viewSql, viewPath,
modifiable != null && modifiable);
final List<String> schemaPath1 =
schemaPath != null ? schemaPath : schema.path(null);
if ((modifiable == null || modifiable)
&& parsed.modifiable
&& parsed.table != null) {
return modifiableViewTable(parsed, viewSql, schemaPath1, viewPath, schema);
} else {
return viewTable(parsed, viewSql, schemaPath1, viewPath);
}
}
开发者ID:apache,项目名称:calcite,代码行数:17,代码来源:ViewTableMacro.java
示例6: testTableWhere
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
@Test public void testTableWhere() throws SQLException,
ClassNotFoundException {
final Connection connection =
CalciteAssert.that(CalciteAssert.Config.JDBC_FOODMART).connect();
final CalciteConnection calciteConnection =
connection.unwrap(CalciteConnection.class);
final SchemaPlus rootSchema = calciteConnection.getRootSchema();
ParameterExpression c =
Expressions.parameter(JdbcTest.Customer.class, "c");
String s =
Schemas.queryable(Schemas.createDataContext(connection, rootSchema),
rootSchema.getSubSchema("foodmart"),
JdbcTest.Customer.class, "customer")
.where(
Expressions.<Predicate1<JdbcTest.Customer>>lambda(
Expressions.lessThan(
Expressions.field(c, "customer_id"),
Expressions.constant(5)),
c))
.toList()
.toString();
Util.discard(s);
}
开发者ID:apache,项目名称:calcite,代码行数:24,代码来源:LinqFrontJdbcBackTest.java
示例7: init
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
/**
* Called after the constructor has completed and the model has been
* loaded.
*/
void init() {
final MaterializationService service = MaterializationService.instance();
for (CalciteSchema.LatticeEntry e : Schemas.getLatticeEntries(rootSchema)) {
final Lattice lattice = e.getLattice();
for (Lattice.Tile tile : lattice.computeTiles()) {
service.defineTile(lattice, tile.bitSet(), tile.measures, e.schema,
true, true);
}
}
}
开发者ID:bitnine-oss,项目名称:octopus,代码行数:15,代码来源:CalciteConnectionImpl.java
示例8: init
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
/** Called after the constructor has completed and the model has been
* loaded. */
void init() {
final MaterializationService service = MaterializationService.instance();
for (CalciteSchema.LatticeEntry e : Schemas.getLatticeEntries(rootSchema)) {
final Lattice lattice = e.getLattice();
for (Lattice.Tile tile : lattice.computeTiles()) {
service.defineTile(lattice, tile.bitSet(), tile.measures, e.schema,
true, true);
}
}
}
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:CalciteConnectionImpl.java
示例9: getTargetExpression
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
/** Returns an expression for the object wrapped by this schema (not the
* schema itself). */
Expression getTargetExpression(SchemaPlus parentSchema, String name) {
return Types.castIfNecessary(
target.getClass(),
Expressions.call(
Schemas.unwrap(
getExpression(parentSchema, name),
ReflectiveSchema.class),
BuiltInMethod.REFLECTIVE_SCHEMA_GET_TARGET.method));
}
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:ReflectiveSchema.java
示例10: create
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
public static JdbcSchema create(
SchemaPlus parentSchema,
String name,
DataSource dataSource,
SqlDialectFactory dialectFactory,
String catalog,
String schema) {
final Expression expression =
Schemas.subSchemaExpression(parentSchema, name, JdbcSchema.class);
final SqlDialect dialect = createDialect(dialectFactory, dataSource);
final JdbcConvention convention =
JdbcConvention.of(dialect, expression, name);
return new JdbcSchema(dataSource, dialect, convention, catalog, schema);
}
开发者ID:apache,项目名称:calcite,代码行数:15,代码来源:JdbcSchema.java
示例11: createCloneTable
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
private Table createCloneTable(QueryProvider queryProvider,
QueryableTable sourceTable, String name) {
final Queryable<Object> queryable =
sourceTable.asQueryable(queryProvider, sourceSchema, name);
final JavaTypeFactory typeFactory =
((CalciteConnection) queryProvider).getTypeFactory();
return createCloneTable(typeFactory, Schemas.proto(sourceTable),
ImmutableList.<RelCollation>of(), null, queryable);
}
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:CloneSchema.java
示例12: modifiableViewTable
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
/** Allows a sub-class to return an extension of {@link ModifiableViewTable}
* by overriding this method. */
protected ModifiableViewTable modifiableViewTable(CalcitePrepare.AnalyzeViewResult parsed,
String viewSql, List<String> schemaPath, List<String> viewPath,
CalciteSchema schema) {
final JavaTypeFactory typeFactory = (JavaTypeFactory) parsed.typeFactory;
final Type elementType = typeFactory.getJavaClass(parsed.rowType);
return new ModifiableViewTable(elementType,
RelDataTypeImpl.proto(parsed.rowType), viewSql, schemaPath, viewPath,
parsed.table, Schemas.path(schema.root(), parsed.tablePath),
parsed.constraint, parsed.columnMapping);
}
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:ViewTableMacro.java
示例13: testSchemaPath
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
/** Test for {@link Path}. */
@Test public void testSchemaPath() {
final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
final FrameworkConfig config = Frameworks.newConfigBuilder()
.defaultSchema(
CalciteAssert.addSchema(rootSchema, CalciteAssert.SchemaSpec.HR))
.build();
final Path path = Schemas.path(config.getDefaultSchema());
assertThat(path.size(), is(2));
assertThat(path.get(0).left, is(""));
assertThat(path.get(1).left, is("hr"));
assertThat(path.names().size(), is(1));
assertThat(path.names().get(0), is("hr"));
assertThat(path.schemas().size(), is(2));
final Path parent = path.parent();
assertThat(parent.size(), is(1));
assertThat(parent.names().size(), is(0));
final Path grandparent = parent.parent();
assertThat(grandparent.size(), is(0));
try {
Object o = grandparent.parent();
fail("expected exception, got " + o);
} catch (IllegalArgumentException e) {
// ok
}
}
开发者ID:apache,项目名称:calcite,代码行数:30,代码来源:FrameworksTest.java
示例14: modifiableViewTable
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
@Override protected ModifiableViewTable modifiableViewTable(
CalcitePrepare.AnalyzeViewResult parsed, String viewSql,
List<String> schemaPath, List<String> viewPath, CalciteSchema schema) {
final JavaTypeFactory typeFactory = (JavaTypeFactory) parsed.typeFactory;
final Type elementType = typeFactory.getJavaClass(parsed.rowType);
return new MockModifiableViewTable(elementType,
RelDataTypeImpl.proto(parsed.rowType), viewSql, schemaPath, viewPath,
parsed.table, Schemas.path(schema.root(), parsed.tablePath),
parsed.constraint, parsed.columnMapping);
}
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:MockCatalogReader.java
示例15: getTablePath
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
@Override public Path getTablePath() {
final ImmutableList.Builder<Pair<String, Schema>> builder =
ImmutableList.builder();
for (String name : fromTable.names) {
builder.add(Pair.<String, Schema>of(name, null));
}
return Schemas.path(builder.build());
}
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:MockCatalogReader.java
示例16: check
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
protected void check(final Action action) throws Exception {
Frameworks.withPrepare(
new Frameworks.PrepareAction<Void>() {
public Void apply(RelOptCluster cluster, RelOptSchema relOptSchema,
SchemaPlus rootSchema, CalciteServerStatement statement) {
final RexBuilder rexBuilder = cluster.getRexBuilder();
DataContext dataContext =
Schemas.createDataContext(statement.getConnection(), rootSchema);
final RexExecutorImpl executor = new RexExecutorImpl(dataContext);
action.check(rexBuilder, executor);
return null;
}
});
}
开发者ID:apache,项目名称:calcite,代码行数:15,代码来源:RexExecutorTest.java
示例17: ConstExecutor
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
public ConstExecutor(FunctionImplementationRegistry funcImplReg, FunctionContext udfUtilities, PlannerSettings plannerSettings) {
this.funcImplReg = funcImplReg;
this.udfUtilities = udfUtilities;
this.plannerSettings = plannerSettings;
this.calciteExecutor = new RexExecutorImpl(Schemas.createDataContext(null));
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:7,代码来源:ConstExecutor.java
示例18: getExpression
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
public Expression getExpression(SchemaPlus schema, String tableName,
Class clazz) {
return Schemas.tableExpression(schema, getElementType(), tableName, clazz);
}
开发者ID:bitnine-oss,项目名称:octopus,代码行数:5,代码来源:OctopusMetaModelTable.java
示例19: getExpression
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
public Expression getExpression(SchemaPlus schema, String tableName,
Class clazz) {
return Schemas.tableExpression(schema, getElementType(), tableName, clazz);
}
开发者ID:qubole,项目名称:quark,代码行数:5,代码来源:QuarkTileTable.java
示例20: getExpression
import org.apache.calcite.schema.Schemas; //导入依赖的package包/类
@Override
public Expression getExpression(SchemaPlus schema, String tableName,
Class clazz) {
return Schemas.tableExpression(schema, getElementType(), tableName, clazz);
}
开发者ID:qubole,项目名称:quark,代码行数:6,代码来源:QuarkTable.java
注:本文中的org.apache.calcite.schema.Schemas类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论