public class SchemaUtilites extends Object
Modifier and Type | Field and Description |
---|---|
static org.apache.drill.shaded.guava.com.google.common.base.Joiner |
SCHEMA_PATH_JOINER |
Constructor and Description |
---|
SchemaUtilites() |
Modifier and Type | Method and Description |
---|---|
static org.apache.calcite.schema.SchemaPlus |
findSchema(org.apache.calcite.schema.SchemaPlus defaultSchema,
List<String> schemaPath)
Search and return schema with given schemaPath.
|
static org.apache.calcite.schema.SchemaPlus |
findSchema(org.apache.calcite.schema.SchemaPlus defaultSchema,
String schemaPath)
Same utility as
findSchema(SchemaPlus, List) except the search schema path given here is complete path
instead of list. |
static String |
getPrefixSchemaPath(String defaultSchema,
String schemaPath,
boolean isCaseSensitive)
Utility function to get the commonPrefix schema between two supplied schemas.
|
static String |
getSchemaPath(List<String> schemaPath)
Utility method to get the schema path for given list of schema path.
|
static String |
getSchemaPath(org.apache.calcite.schema.SchemaPlus schema)
Utility method to get the schema path for given schema instance.
|
static List<String> |
getSchemaPath(org.apache.calcite.sql.SqlIdentifier tableIdentifier)
Returns schema path which corresponds to the specified table identifier.
|
static List<String> |
getSchemaPathAsList(org.apache.calcite.schema.SchemaPlus schema)
Utility method to get the schema path as list for given schema instance.
|
static List<String> |
getSchemaPathAsList(String schemaPath)
Utility method to get the list with schema path components for given schema path string.
|
static AbstractSchema |
getTemporaryWorkspace(org.apache.calcite.schema.SchemaPlus defaultSchema,
DrillConfig config)
Looks in schema tree for default temporary workspace instance.
|
static boolean |
isRootSchema(org.apache.calcite.schema.SchemaPlus schema) |
static boolean |
isTemporaryWorkspace(String schemaPath,
DrillConfig config)
Checks that passed schema path is the same as temporary workspace path.
|
static AbstractSchema |
resolveToDrillSchema(org.apache.calcite.schema.SchemaPlus defaultSchema,
List<String> schemaPath)
Given reference to default schema in schema tree, search for schema with given schemaPath.
|
static AbstractSchema |
resolveToMutableDrillSchema(org.apache.calcite.schema.SchemaPlus defaultSchema,
List<String> schemaPath)
Given reference to default schema in schema tree, search for schema with given schemaPath.
|
static AbstractSchema |
resolveToTemporarySchema(List<String> tableSchema,
org.apache.calcite.schema.SchemaPlus defaultSchema,
DrillConfig config)
If table schema is not indicated in sql call, returns temporary workspace.
|
static WorkspaceSchemaFactory.WorkspaceSchema |
resolveToValidTemporaryWorkspace(AbstractSchema schema,
DrillConfig config)
Makes sure that passed workspace exists, is default temporary workspace, mutable and file-based
(instance of
WorkspaceSchemaFactory.WorkspaceSchema ). |
static org.apache.calcite.schema.SchemaPlus |
rootSchema(org.apache.calcite.schema.SchemaPlus schema)
Finds root of given schema.
|
static org.apache.calcite.schema.SchemaPlus |
searchSchemaTree(org.apache.calcite.schema.SchemaPlus schema,
List<String> schemaPath)
Utility method to search for schema path starting from the given schema reference
|
static void |
throwSchemaNotFoundException(org.apache.calcite.schema.SchemaPlus defaultSchema,
List<String> givenSchemaPath)
Utility method to throw
UserException with context information |
static void |
throwSchemaNotFoundException(org.apache.calcite.schema.SchemaPlus defaultSchema,
String givenSchemaPath)
Utility method to throw
UserException with context information |
static AbstractSchema |
unwrapAsDrillSchemaInstance(org.apache.calcite.schema.SchemaPlus schemaPlus)
Unwrap given SchemaPlus instance as Drill schema instance (AbstractSchema).
|
public static final org.apache.drill.shaded.guava.com.google.common.base.Joiner SCHEMA_PATH_JOINER
public static org.apache.calcite.schema.SchemaPlus findSchema(org.apache.calcite.schema.SchemaPlus defaultSchema, List<String> schemaPath)
defaultSchema
- Reference to the default schema in complete schema tree.schemaPath
- Schema path to search.public static org.apache.calcite.schema.SchemaPlus findSchema(org.apache.calcite.schema.SchemaPlus defaultSchema, String schemaPath)
findSchema(SchemaPlus, List)
except the search schema path given here is complete path
instead of list. Use "." separator to divided the schema into nested schema names.defaultSchema
- default schemaschemaPath
- current schema pathpublic static String getPrefixSchemaPath(String defaultSchema, String schemaPath, boolean isCaseSensitive)
defaultSchema
- default schemaschemaPath
- current schema pathisCaseSensitive
- true if caseSensitive comparision is required.public static org.apache.calcite.schema.SchemaPlus searchSchemaTree(org.apache.calcite.schema.SchemaPlus schema, List<String> schemaPath)
public static boolean isRootSchema(org.apache.calcite.schema.SchemaPlus schema)
schema
- current schemapublic static AbstractSchema unwrapAsDrillSchemaInstance(org.apache.calcite.schema.SchemaPlus schemaPlus)
UserException
is thrown.public static String getSchemaPath(org.apache.calcite.schema.SchemaPlus schema)
public static String getSchemaPath(List<String> schemaPath)
public static List<String> getSchemaPathAsList(String schemaPath)
public static List<String> getSchemaPathAsList(org.apache.calcite.schema.SchemaPlus schema)
public static void throwSchemaNotFoundException(org.apache.calcite.schema.SchemaPlus defaultSchema, String givenSchemaPath)
UserException
with context informationpublic static void throwSchemaNotFoundException(org.apache.calcite.schema.SchemaPlus defaultSchema, List<String> givenSchemaPath)
UserException
with context informationpublic static AbstractSchema resolveToMutableDrillSchema(org.apache.calcite.schema.SchemaPlus defaultSchema, List<String> schemaPath)
UserException
is throws when:
defaultSchema
- default schemaschemaPath
- current schema pathpublic static AbstractSchema resolveToDrillSchema(org.apache.calcite.schema.SchemaPlus defaultSchema, List<String> schemaPath)
UserException
is throws when:
defaultSchema
- schemaPath
- UserException
public static AbstractSchema getTemporaryWorkspace(org.apache.calcite.schema.SchemaPlus defaultSchema, DrillConfig config)
defaultSchema
- default schemaconfig
- drill configpublic static boolean isTemporaryWorkspace(String schemaPath, DrillConfig config)
schemaPath
- schema pathconfig
- drill configpublic static WorkspaceSchemaFactory.WorkspaceSchema resolveToValidTemporaryWorkspace(AbstractSchema schema, DrillConfig config)
WorkspaceSchemaFactory.WorkspaceSchema
).schema
- drill schemaconfig
- drill configpublic static AbstractSchema resolveToTemporarySchema(List<String> tableSchema, org.apache.calcite.schema.SchemaPlus defaultSchema, DrillConfig config)
tableSchema
- table schemadefaultSchema
- default schemaconfig
- drill configpublic static org.apache.calcite.schema.SchemaPlus rootSchema(org.apache.calcite.schema.SchemaPlus schema)
schema
- current schemapublic static List<String> getSchemaPath(org.apache.calcite.sql.SqlIdentifier tableIdentifier)
tableIdentifier
- table identifierCopyright © 1970 The Apache Software Foundation. All rights reserved.