You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "zhaozhangwan (Jira)" <ji...@apache.org> on 2019/11/19 13:00:02 UTC

[jira] [Updated] (FLINK-14858) Coding error,this should be "else if" not the "if".

     [ https://issues.apache.org/jira/browse/FLINK-14858?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

zhaozhangwan updated FLINK-14858:
---------------------------------
    Description: 
The line of SqlDropTable,this should be "else if" not the "if".

 
{code:java}
// code placeholder

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) {
      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}

  was:
This should be "else if" not the "if".
{code:java}
// code placeholder

/**
 * This is the main entrance for executing all kinds of DDL/DML {@code SqlNode}s, different
 * SqlNode will have it's implementation in the #convert(type) method whose 'type' argument
 * is subclass of {@code SqlNode}.
 *
 * @param flinkPlanner     FlinkPlannerImpl to convertCreateTable sql node to rel node
 * @param sqlNode          SqlNode to execute on
 */
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) {
      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}


> Coding error,this should be "else if" not the "if".
> ---------------------------------------------------
>
>                 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
>            Priority: Trivial
>             Fix For: 1.10.0
>
>
> The line of SqlDropTable,this should be "else if" not the "if".
>  
> {code:java}
> // code placeholder
> 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) {
>       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}



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