public class SqlHandlerUtil extends Object
| Constructor and Description |
|---|
SqlHandlerUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
dropTableFromSchema(AbstractSchema drillSchema,
String tableName)
Drops table from schema.
|
static void |
dropViewFromSchema(AbstractSchema drillSchema,
String viewName)
Drops view from schema.
|
static org.apache.calcite.schema.Table |
getTableFromSchema(AbstractSchema drillSchema,
String tblName) |
static org.apache.calcite.rel.RelNode |
qualifyPartitionCol(org.apache.calcite.rel.RelNode input,
List<String> partitionColumns)
Resolve the partition columns specified in "PARTITION BY" clause of CTAS statement.
|
static org.apache.calcite.rel.RelNode |
resolveNewTableRel(boolean isNewTableView,
List<String> tableFieldNames,
org.apache.calcite.rel.type.RelDataType validatedRowtype,
org.apache.calcite.rel.RelNode queryRelNode)
Resolve final RelNode of the new table (or view) for given table field list and new table definition.
|
static void |
unparseSqlNodeList(org.apache.calcite.sql.SqlWriter writer,
int leftPrec,
int rightPrec,
org.apache.calcite.sql.SqlNodeList fieldList) |
public static org.apache.calcite.rel.RelNode resolveNewTableRel(boolean isNewTableView,
List<String> tableFieldNames,
org.apache.calcite.rel.type.RelDataType validatedRowtype,
org.apache.calcite.rel.RelNode queryRelNode)
throws org.apache.calcite.tools.ValidationException,
org.apache.calcite.tools.RelConversionException
isNewTableView - Is the new table created a view? This doesn't affect the functionality, but it helps format
better error messages.tableFieldNames - List of fields specified in new table/view field list. These are the fields given just after
new table name.
Ex. CREATE TABLE newTblName(col1, medianOfCol2, avgOfCol3) AS
SELECT col1, median(col2), avg(col3) FROM sourcetbl GROUP BY col1;org.apache.calcite.tools.ValidationException - If table's fields list and field list specified in table definition are not valid.org.apache.calcite.tools.RelConversionException - If failed to convert the table definition into a RelNode.public static org.apache.calcite.rel.RelNode qualifyPartitionCol(org.apache.calcite.rel.RelNode input,
List<String> partitionColumns)
input - : the RelNode represents the select statement in CTAS.partitionColumns - : the list of partition columns.public static org.apache.calcite.schema.Table getTableFromSchema(AbstractSchema drillSchema, String tblName)
public static void unparseSqlNodeList(org.apache.calcite.sql.SqlWriter writer,
int leftPrec,
int rightPrec,
org.apache.calcite.sql.SqlNodeList fieldList)
public static void dropTableFromSchema(AbstractSchema drillSchema, String tableName)
@UserException since drop was unsuccessful,
otherwise assumes that other user had dropped the view and exists without error.drillSchema - drill schematableName - table namepublic static void dropViewFromSchema(AbstractSchema drillSchema, String viewName) throws IOException
@UserException since drop was unsuccessful,
otherwise assumes that other user had dropped the view and exists without error.drillSchema - drill schemaviewName - view nameIOExceptionCopyright © 2017 The Apache Software Foundation. All rights reserved.