Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-19281

LIKE cannot recognize full table path

    XMLWordPrintableJSON

Details

    Description

      for example, if we have a table whose full path is default_catalog.default_database.my_table1, and the following DDL will fail

      create table my_table2 
      like default_catalog.default_database.my_table1
      

      it will throw

      Exception in thread "main" org.apache.flink.table.api.ValidationException: Source table '`default_catalog`.`default_database`.`default_catalog.default_database.my_table1`' of the LIKE clause not found in the catalog, at line 11, column 6
      	at org.apache.flink.table.planner.operations.SqlCreateTableConverter.lambda$lookupLikeSourceTable$1(SqlCreateTableConverter.java:207)
      	at java.util.Optional.orElseThrow(Optional.java:290)
      	at org.apache.flink.table.planner.operations.SqlCreateTableConverter.lookupLikeSourceTable(SqlCreateTableConverter.java:207)
      	at org.apache.flink.table.planner.operations.SqlCreateTableConverter.createCatalogTable(SqlCreateTableConverter.java:103)
      	at org.apache.flink.table.planner.operations.SqlCreateTableConverter.convertCreateTable(SqlCreateTableConverter.java:83)
      	at org.apache.flink.table.planner.operations.SqlToOperationConverter.convert(SqlToOperationConverter.java:188)
      	at org.apache.flink.table.planner.delegation.ParserImpl.convertSqlNodeToOperation(ParserImpl.java:92)
      	at org.apache.flink.table.api.internal.TableEnvironmentImpl.sqlInternal(TableEnvironmentImpl.java:724)
      	at org.apache.flink.table.api.internal.TableEnvironmentImpl.sql(TableEnvironmentImpl.java:704)
      

      We can fix it in SqlCreateTableConverter#lookupLikeSourceTable, via using `SqlTableLike`'s full name.

      Attachments

        Issue Links

          Activity

            People

              ZhuShang zhuxiaoshang
              libenchao Benchao Li
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: