本文整理汇总了Java中org.apache.calcite.jdbc.CalciteSchema.path方法的典型用法代码示例。如果您正苦于以下问题:Java CalciteSchema.path方法的具体用法?Java CalciteSchema.path怎么用?Java CalciteSchema.path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.jdbc.CalciteSchema
的用法示例。
在下文中一共展示了CalciteSchema.path方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: perform
import org.apache.calcite.jdbc.CalciteSchema; //导入方法依赖的package包/类
/** Executes a prepare action. */
public <R> R perform(CalciteServerStatement statement,
Frameworks.PrepareAction<R> action) {
final CalcitePrepare.Context prepareContext =
statement.createPrepareContext();
final JavaTypeFactory typeFactory = prepareContext.getTypeFactory();
final CalciteSchema schema =
action.getConfig().getDefaultSchema() != null
? CalciteSchema.from(action.getConfig().getDefaultSchema())
: prepareContext.getRootSchema();
CalciteCatalogReader catalogReader =
new CalciteCatalogReader(schema.root(),
prepareContext.config().caseSensitive(),
schema.path(null),
typeFactory);
final RexBuilder rexBuilder = new RexBuilder(typeFactory);
final RelOptPlanner planner =
createPlanner(prepareContext,
action.getConfig().getContext(),
action.getConfig().getCostFactory());
final RelOptCluster cluster = createCluster(planner, rexBuilder);
return action.apply(cluster, catalogReader,
prepareContext.getRootSchema().plus(), statement);
}
示例2: perform
import org.apache.calcite.jdbc.CalciteSchema; //导入方法依赖的package包/类
/** Executes a prepare action. */
public <R> R perform(CalciteServerStatement statement,
Frameworks.PrepareAction<R> action) {
final CalcitePrepare.Context prepareContext =
statement.createPrepareContext();
final JavaTypeFactory typeFactory = prepareContext.getTypeFactory();
final CalciteSchema schema =
action.getConfig().getDefaultSchema() != null
? CalciteSchema.from(action.getConfig().getDefaultSchema())
: prepareContext.getRootSchema();
CalciteCatalogReader catalogReader =
new CalciteCatalogReader(schema.root(),
schema.path(null),
typeFactory,
prepareContext.config());
final RexBuilder rexBuilder = new RexBuilder(typeFactory);
final RelOptPlanner planner =
createPlanner(prepareContext,
action.getConfig().getContext(),
action.getConfig().getCostFactory());
final RelOptCluster cluster = createCluster(planner, rexBuilder);
return action.apply(cluster, catalogReader,
prepareContext.getRootSchema().plus(), statement);
}
示例3: visit
import org.apache.calcite.jdbc.CalciteSchema; //导入方法依赖的package包/类
public void visit(JsonMaterialization jsonMaterialization) {
try {
checkRequiredAttributes(jsonMaterialization, "sql");
final SchemaPlus schema = currentSchema();
if (!schema.isMutable()) {
throw new RuntimeException(
"Cannot define materialization; parent schema '"
+ currentSchemaName()
+ "' is not a SemiMutableSchema");
}
CalciteSchema calciteSchema = CalciteSchema.from(schema);
final String viewName;
final boolean existing;
if (jsonMaterialization.view == null) {
// If the user did not supply a view name, that means the materialized
// view is pre-populated. Generate a synthetic view name.
viewName = "$" + schema.getTableNames().size();
existing = true;
} else {
viewName = jsonMaterialization.view;
existing = false;
}
List<String> viewPath = calciteSchema.path(viewName);
schema.add(viewName,
MaterializedViewTable.create(calciteSchema,
jsonMaterialization.getSql(), jsonMaterialization.viewSchemaPath, viewPath,
jsonMaterialization.table, existing));
} catch (Exception e) {
throw new RuntimeException("Error instantiating " + jsonMaterialization,
e);
}
}
示例4: moniker
import org.apache.calcite.jdbc.CalciteSchema; //导入方法依赖的package包/类
private SqlMonikerImpl moniker(CalciteSchema schema, String name,
SqlMonikerType type) {
final List<String> path = schema.path(name);
if (path.size() == 1
&& !schema.root().name.equals("")
&& type == SqlMonikerType.SCHEMA) {
type = SqlMonikerType.CATALOG;
}
return new SqlMonikerImpl(path, type);
}
示例5: MaterializedViewTableMacro
import org.apache.calcite.jdbc.CalciteSchema; //导入方法依赖的package包/类
private MaterializedViewTableMacro(CalciteSchema schema, String viewSql,
List<String> viewSchemaPath, List<String> viewPath, String suggestedTableName,
boolean existing) {
super(schema, viewSql,
viewSchemaPath != null ? viewSchemaPath : schema.path(null), viewPath,
Boolean.TRUE);
this.key = Preconditions.checkNotNull(
MaterializationService.instance().defineMaterialization(
schema, null, viewSql, schemaPath, suggestedTableName, true,
existing));
}
示例6: makeContext
import org.apache.calcite.jdbc.CalciteSchema; //导入方法依赖的package包/类
private static CalcitePrepare.Context makeContext(
final CalciteConnectionConfig connectionConfig,
final JavaTypeFactory typeFactory,
final DataContext dataContext,
final CalciteSchema schema,
final List<String> schemaPath, final List<String> objectPath_) {
final ImmutableList<String> objectPath =
objectPath_ == null ? null : ImmutableList.copyOf(objectPath_);
return new CalcitePrepare.Context() {
public JavaTypeFactory getTypeFactory() {
return typeFactory;
}
public CalciteSchema getRootSchema() {
return schema.root();
}
public CalciteSchema getMutableRootSchema() {
return getRootSchema();
}
public List<String> getDefaultSchemaPath() {
// schemaPath is usually null. If specified, it overrides schema
// as the context within which the SQL is validated.
if (schemaPath == null) {
return schema.path(null);
}
return schemaPath;
}
public List<String> getObjectPath() {
return objectPath;
}
public CalciteConnectionConfig config() {
return connectionConfig;
}
public DataContext getDataContext() {
return dataContext;
}
public RelRunner getRelRunner() {
throw new UnsupportedOperationException();
}
public CalcitePrepare.SparkHandler spark() {
final boolean enable = config().spark();
return CalcitePrepare.Dummy.getSparkHandler(enable);
}
};
}