[
https://issues.apache.org/jira/browse/FLINK-14858?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
zhaozhangwan updated FLINK-14858:
---------------------------------
Description:
In class {{org.apache.flink.table.sqlexec.SqlToOperationConverter}}
{code:java}
public static Optional<Operation> convert(
FlinkPlannerImpl flinkPlanner,
CatalogManager catalogManager,
SqlNode sqlNode) {
// validate the query
final SqlNode validated = flinkPlanner.validate(sqlNode);
SqlToOperationConverter converter = new
SqlToOperationConverter(flinkPlanner, catalogManager);
if (validated instanceof SqlCreateTable) {
return Optional.of(converter.convertCreateTable((SqlCreateTable)
validated));
} if (validated instanceof SqlDropTable) { // this should be "else if" not
the "if"
return Optional.of(converter.convertDropTable((SqlDropTable) validated));
} else if (validated instanceof RichSqlInsert) {
SqlNodeList targetColumnList = ((RichSqlInsert)
validated).getTargetColumnList();
if (targetColumnList != null && targetColumnList.size() != 0) {
throw new ValidationException("Partial inserts are not supported");
}
return Optional.of(converter.convertSqlInsert((RichSqlInsert) validated));
} else if (validated.getKind().belongsTo(SqlKind.QUERY)) {
return Optional.of(converter.convertSqlQuery(validated));
} else {
return Optional.empty();
}
}{code}
was:
In class {{org.apache.flink.table.sqlexec.SqlToOperationConverter}}
{code:java}
public static Operation convert(FlinkPlannerImpl flinkPlanner, SqlNode sqlNode)
{
// validate the query
final SqlNode validated = flinkPlanner.validate(sqlNode);
SqlToOperationConverter converter = new
SqlToOperationConverter(flinkPlanner);
if (validated instanceof SqlCreateTable) {
return converter.convertCreateTable((SqlCreateTable) validated);
} if (validated instanceof SqlDropTable) { // this
should be "else if" not the "if"
return converter.convertDropTable((SqlDropTable) validated);
} else if (validated instanceof RichSqlInsert) {
return converter.convertSqlInsert((RichSqlInsert) validated);
} else if (validated.getKind().belongsTo(SqlKind.QUERY)) {
return converter.convertSqlQuery(validated);
} else {
throw new TableException("Unsupported node type "
+ validated.getClass().getSimpleName());
}
}{code}
And,the same wrong in class
org.apache.flink.table.planner.operations.SqlToOperationConverter
> Wrong "if" statement in SqlToOperationConverter
> -----------------------------------------------
>
> Key: FLINK-14858
> URL: https://issues.apache.org/jira/browse/FLINK-14858
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Planner
> Affects Versions: 1.9.1
> Reporter: zhaozhangwan
> Assignee: zhaozhangwan
> Priority: Trivial
> Fix For: 1.10.0
>
>
> In class {{org.apache.flink.table.sqlexec.SqlToOperationConverter}}
> {code:java}
> public static Optional<Operation> convert(
> FlinkPlannerImpl flinkPlanner,
> CatalogManager catalogManager,
> SqlNode sqlNode) {
> // validate the query
> final SqlNode validated = flinkPlanner.validate(sqlNode);
> SqlToOperationConverter converter = new
> SqlToOperationConverter(flinkPlanner, catalogManager);
> if (validated instanceof SqlCreateTable) {
> return Optional.of(converter.convertCreateTable((SqlCreateTable)
> validated));
> } if (validated instanceof SqlDropTable) { // this should be "else if"
> not the "if"
> return Optional.of(converter.convertDropTable((SqlDropTable)
> validated));
> } else if (validated instanceof RichSqlInsert) {
> SqlNodeList targetColumnList = ((RichSqlInsert)
> validated).getTargetColumnList();
> if (targetColumnList != null && targetColumnList.size() != 0) {
> throw new ValidationException("Partial inserts are not supported");
> }
> return Optional.of(converter.convertSqlInsert((RichSqlInsert)
> validated));
> } else if (validated.getKind().belongsTo(SqlKind.QUERY)) {
> return Optional.of(converter.convertSqlQuery(validated));
> } else {
> return Optional.empty();
> }
> }{code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)