本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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();
}
}
示例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;
}