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

INSERT INTO VALUES statement fails if a cast project is applied

    XMLWordPrintableJSON

Details

    Description

      The following query will fail:

        @Test
        def test(): Unit = {
          val sinkDDL =
            """
              |create table t2(
              |  a int,
              |  b string
              |) with (
              |  'connector' = 'COLLECTION'
              |)
            """.stripMargin
          val query =
            """
              |insert into t2 select cast(a as int), cast(b as varchar) from (values (3, 'c')) T(a,b)
            """.stripMargin
          tableEnv.sqlUpdate(sinkDDL)
          tableEnv.sqlUpdate(query)
          execJob("testJob")
        }
      

      exception:

      org.apache.flink.table.api.TableException: Cannot generate a valid execution plan for the given query: 
      
      LogicalSink(name=[`default_catalog`.`default_database`.`t2`], fields=[a, b])
      +- LogicalProject(EXPR$0=[$0], EXPR$1=[CAST($1):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" NOT NULL])
         +- LogicalValues(type=[RecordType(INTEGER a, CHAR(1) b)], tuples=[[{ 3, _UTF-16LE'c' }]])
      
      This exception indicates that the query uses an unsupported SQL feature.
      Please check the documentation for the set of currently supported SQL features.
      

      Attachments

        Issue Links

          Activity

            People

              godfreyhe godfrey he
              jark Jark Wu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m