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

Hirson Zhang updated FLINK-37357:
---------------------------------
    Description: 
There is a "TODO" at class "SqlNodeToOperationConversion", method 
"convertValidatedSqlNode": 

"TODO: all the below conversion logic should be migrated to SqlNodeConverters".

Part of the code: 
{code:java}
/** Convert a validated sql node to Operation. */
private static Optional<Operation> convertValidatedSqlNode(
        FlinkPlannerImpl flinkPlanner, CatalogManager catalogManager, SqlNode 
validated) {
    beforeConversion();    // delegate conversion to the registered converters 
first
    SqlNodeConvertContext context = new SqlNodeConvertContext(flinkPlanner, 
catalogManager);
    Optional<Operation> operation = SqlNodeConverters.convertSqlNode(validated, 
context);
    if (operation.isPresent()) {
        return operation;
    }    // TODO: all the below conversion logic should be migrated to 
SqlNodeConverters
    SqlNodeToOperationConversion converter =
            new SqlNodeToOperationConversion(flinkPlanner, catalogManager);
    if (validated instanceof SqlDropCatalog) {
        return Optional.of(converter.convertDropCatalog((SqlDropCatalog) 
validated));
    } else if (validated instanceof SqlLoadModule) {
        return Optional.of(converter.convertLoadModule((SqlLoadModule) 
validated));
    } else if (validated instanceof SqlShowCurrentCatalog) {
        return Optional.of(
                converter.convertShowCurrentCatalog((SqlShowCurrentCatalog) 
validated));
    } else if (validated instanceof SqlShowModules) {
        return Optional.of(converter.convertShowModules((SqlShowModules) 
validated)); 
.....{code}

  was:
There is a "TODO" at class "SqlNodeToOperationConversion", method 
"convertValidatedSqlNode": 

"TODO: all the below conversion logic should be migrated to SqlNodeConverters".

 
{code:java}
/** Convert a validated sql node to Operation. */
private static Optional<Operation> convertValidatedSqlNode(
        FlinkPlannerImpl flinkPlanner, CatalogManager catalogManager, SqlNode 
validated) {
    beforeConversion();    // delegate conversion to the registered converters 
first
    SqlNodeConvertContext context = new SqlNodeConvertContext(flinkPlanner, 
catalogManager);
    Optional<Operation> operation = SqlNodeConverters.convertSqlNode(validated, 
context);
    if (operation.isPresent()) {
        return operation;
    }    // TODO: all the below conversion logic should be migrated to 
SqlNodeConverters
    SqlNodeToOperationConversion converter =
            new SqlNodeToOperationConversion(flinkPlanner, catalogManager);
    if (validated instanceof SqlDropCatalog) {
        return Optional.of(converter.convertDropCatalog((SqlDropCatalog) 
validated));
    } else if (validated instanceof SqlLoadModule) {
        return Optional.of(converter.convertLoadModule((SqlLoadModule) 
validated));
    } else if (validated instanceof SqlShowCurrentCatalog) {
        return Optional.of(
                converter.convertShowCurrentCatalog((SqlShowCurrentCatalog) 
validated));
    } else if (validated instanceof SqlShowModules) {
        return Optional.of(converter.convertShowModules((SqlShowModules) 
validated)); 
.....{code}


> Migrating conversion logic to SqlNodeConverters
> -----------------------------------------------
>
>                 Key: FLINK-37357
>                 URL: https://issues.apache.org/jira/browse/FLINK-37357
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / Planner
>    Affects Versions: 2.0-preview
>            Reporter: Hirson Zhang
>            Priority: Major
>
> There is a "TODO" at class "SqlNodeToOperationConversion", method 
> "convertValidatedSqlNode": 
> "TODO: all the below conversion logic should be migrated to 
> SqlNodeConverters".
> Part of the code: 
> {code:java}
> /** Convert a validated sql node to Operation. */
> private static Optional<Operation> convertValidatedSqlNode(
>         FlinkPlannerImpl flinkPlanner, CatalogManager catalogManager, SqlNode 
> validated) {
>     beforeConversion();    // delegate conversion to the registered 
> converters first
>     SqlNodeConvertContext context = new SqlNodeConvertContext(flinkPlanner, 
> catalogManager);
>     Optional<Operation> operation = 
> SqlNodeConverters.convertSqlNode(validated, context);
>     if (operation.isPresent()) {
>         return operation;
>     }    // TODO: all the below conversion logic should be migrated to 
> SqlNodeConverters
>     SqlNodeToOperationConversion converter =
>             new SqlNodeToOperationConversion(flinkPlanner, catalogManager);
>     if (validated instanceof SqlDropCatalog) {
>         return Optional.of(converter.convertDropCatalog((SqlDropCatalog) 
> validated));
>     } else if (validated instanceof SqlLoadModule) {
>         return Optional.of(converter.convertLoadModule((SqlLoadModule) 
> validated));
>     } else if (validated instanceof SqlShowCurrentCatalog) {
>         return Optional.of(
>                 converter.convertShowCurrentCatalog((SqlShowCurrentCatalog) 
> validated));
>     } else if (validated instanceof SqlShowModules) {
>         return Optional.of(converter.convertShowModules((SqlShowModules) 
> validated)); 
> .....{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to