[ 
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 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

  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}


> 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 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



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to