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


Java SchemaPlus.getParentSchema方法代码示例

本文整理汇总了Java中org.apache.calcite.schema.SchemaPlus.getParentSchema方法的典型用法代码示例。如果您正苦于以下问题:Java SchemaPlus.getParentSchema方法的具体用法?Java SchemaPlus.getParentSchema怎么用?Java SchemaPlus.getParentSchema使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.calcite.schema.SchemaPlus的用法示例。


在下文中一共展示了SchemaPlus.getParentSchema方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findSchema

import org.apache.calcite.schema.SchemaPlus; //导入方法依赖的package包/类
/**
 * Search and return schema with given schemaPath. First search in schema tree starting from defaultSchema,
 * if not found search starting from rootSchema. Root schema tree is derived from the defaultSchema reference.
 *
 * @param defaultSchema Reference to the default schema in complete schema tree.
 * @param schemaPath Schema path to search.
 * @return SchemaPlus object.
 */
public static SchemaPlus findSchema(final SchemaPlus defaultSchema, final List<String> schemaPath) {
  if (schemaPath.size() == 0) {
    return defaultSchema;
  }

  SchemaPlus schema;
  if ((schema = searchSchemaTree(defaultSchema, schemaPath)) != null) {
    return schema;
  }

  SchemaPlus rootSchema = defaultSchema;
  while(rootSchema.getParentSchema() != null) {
    rootSchema = rootSchema.getParentSchema();
  }

  if (rootSchema != defaultSchema &&
      (schema = searchSchemaTree(rootSchema, schemaPath)) != null) {
    return schema;
  }

  return null;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:31,代码来源:SchemaUtilites.java

示例2: getSchemaPathAsList

import org.apache.calcite.schema.SchemaPlus; //导入方法依赖的package包/类
/** Utility method to get the schema path as list for given schema instance. */
public static List<String> getSchemaPathAsList(SchemaPlus schema) {
  if (isRootSchema(schema)) {
    return Collections.EMPTY_LIST;
  }

  List<String> path = Lists.newArrayListWithCapacity(5);
  while(schema != null) {
    final String name = schema.getName();
    if (!Strings.isNullOrEmpty(name)) {
      path.add(schema.getName());
    }
    schema = schema.getParentSchema();
  }

  return Lists.reverse(path);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:18,代码来源:SchemaUtilites.java

示例3: qualify

import org.apache.calcite.schema.SchemaPlus; //导入方法依赖的package包/类
public static List<String> qualify(SchemaPlus schema, String tableName){
  LinkedList<String> names = new LinkedList<>();
  while(schema != null && schema.getParentSchema() != null){
    names.addFirst(schema.getName());
    schema = schema.getParentSchema();
  }
  names.add(tableName);
  return names;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:10,代码来源:SchemaUtilities.java

示例4: rootSchema

import org.apache.calcite.schema.SchemaPlus; //导入方法依赖的package包/类
private static SchemaPlus rootSchema(SchemaPlus schema) {
  while (true) {
    if (schema.getParentSchema() == null) {
      return schema;
    }
    schema = schema.getParentSchema();
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:9,代码来源:SqlConverter.java

示例5: isRootSchema

import org.apache.calcite.schema.SchemaPlus; //导入方法依赖的package包/类
/**
 * Returns true if the given <i>schema</i> is root schema. False otherwise.
 * @param schema
 * @return
 */
public static boolean isRootSchema(SchemaPlus schema) {
  return schema.getParentSchema() == null;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:9,代码来源:SchemaUtilites.java


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