当前位置: 首页>>代码示例>>Java>>正文


Java CalciteSchema.path方法代码示例

本文整理汇总了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);
}
 
开发者ID:apache,项目名称:kylin,代码行数:25,代码来源:CalcitePrepareImpl.java

示例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);
}
 
开发者ID:apache,项目名称:calcite,代码行数:25,代码来源:CalcitePrepareImpl.java

示例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);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:34,代码来源:ModelHandler.java

示例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);
}
 
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:CalciteCatalogReader.java

示例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));
}
 
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:MaterializedViewTable.java

示例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);
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:53,代码来源:Schemas.java


注:本文中的org.apache.calcite.jdbc.CalciteSchema.path方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。