use of org.apache.flink.table.catalog.UnresolvedIdentifier in project flink by apache.
the class SqlToOperationConverter method convertDropTable.
// ~ Tools ------------------------------------------------------------------
/**
* Convert DROP TABLE statement.
*/
private Operation convertDropTable(SqlDropTable sqlDropTable) {
UnresolvedIdentifier unresolvedIdentifier = UnresolvedIdentifier.of(sqlDropTable.fullTableName());
ObjectIdentifier identifier = catalogManager.qualifyIdentifier(unresolvedIdentifier);
return new DropTableOperation(identifier, sqlDropTable.getIfExists(), sqlDropTable.isTemporary());
}
use of org.apache.flink.table.catalog.UnresolvedIdentifier in project flink by apache.
the class SqlToOperationConverter method convertSqlInsert.
/**
* Convert insert into statement.
*/
private Operation convertSqlInsert(RichSqlInsert insert) {
// Get sink table name.
List<String> targetTablePath = ((SqlIdentifier) insert.getTargetTableID()).names;
// Get sink table hints.
HintStrategyTable hintStrategyTable = flinkPlanner.config().getSqlToRelConverterConfig().getHintStrategyTable();
List<RelHint> tableHints = SqlUtil.getRelHint(hintStrategyTable, insert.getTableHints());
Map<String, String> dynamicOptions = FlinkHints.getHintedOptions(tableHints);
UnresolvedIdentifier unresolvedIdentifier = UnresolvedIdentifier.of(targetTablePath);
ObjectIdentifier identifier = catalogManager.qualifyIdentifier(unresolvedIdentifier);
ContextResolvedTable contextResolvedTable = catalogManager.getTableOrError(identifier);
PlannerQueryOperation query = (PlannerQueryOperation) convertValidatedSqlNodeOrFail(flinkPlanner, catalogManager, insert.getSource());
return new SinkModifyOperation(contextResolvedTable, query, insert.getStaticPartitionKVs(), insert.isOverwrite(), dynamicOptions);
}
use of org.apache.flink.table.catalog.UnresolvedIdentifier in project flink by apache.
the class SqlToOperationConverter method convertShowPartitions.
/**
* Convert SHOW PARTITIONS statement.
*/
private Operation convertShowPartitions(SqlShowPartitions sqlShowPartitions) {
UnresolvedIdentifier unresolvedIdentifier = UnresolvedIdentifier.of(sqlShowPartitions.fullTableName());
ObjectIdentifier tableIdentifier = catalogManager.qualifyIdentifier(unresolvedIdentifier);
LinkedHashMap<String, String> partitionKVs = sqlShowPartitions.getPartitionKVs();
if (partitionKVs != null) {
CatalogPartitionSpec partitionSpec = new CatalogPartitionSpec(partitionKVs);
return new ShowPartitionsOperation(tableIdentifier, partitionSpec);
}
return new ShowPartitionsOperation(tableIdentifier, null);
}
use of org.apache.flink.table.catalog.UnresolvedIdentifier in project flink by apache.
the class SqlCreateTableConverter method lookupLikeSourceTable.
private CatalogTable lookupLikeSourceTable(SqlTableLike sqlTableLike) {
UnresolvedIdentifier unresolvedIdentifier = UnresolvedIdentifier.of(sqlTableLike.getSourceTable().names);
ObjectIdentifier identifier = catalogManager.qualifyIdentifier(unresolvedIdentifier);
ContextResolvedTable lookupResult = catalogManager.getTable(identifier).orElseThrow(() -> new ValidationException(String.format("Source table '%s' of the LIKE clause not found in the catalog, at %s", identifier, sqlTableLike.getSourceTable().getParserPosition())));
if (!(lookupResult.getTable() instanceof CatalogTable)) {
throw new ValidationException(String.format("Source table '%s' of the LIKE clause can not be a VIEW, at %s", identifier, sqlTableLike.getSourceTable().getParserPosition()));
}
return lookupResult.getTable();
}
use of org.apache.flink.table.catalog.UnresolvedIdentifier in project flink by apache.
the class FunctionCatalogOperatorTable method lookupOperatorOverloads.
@Override
public void lookupOperatorOverloads(SqlIdentifier opName, SqlFunctionCategory category, SqlSyntax syntax, List<SqlOperator> operatorList, SqlNameMatcher nameMatcher) {
if (opName.isStar()) {
return;
}
final UnresolvedIdentifier identifier = UnresolvedIdentifier.of(opName.names);
functionCatalog.lookupFunction(identifier).flatMap(resolvedFunction -> convertToSqlFunction(category, resolvedFunction)).ifPresent(operatorList::add);
}
Aggregations