use of org.apache.calcite.rel.hint.HintStrategyTable 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);
}
Aggregations