Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-12251 Rework the Table API & SQL type system
  3. FLINK-24204

Failed to insert nested types using value construction functions

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.13.2
    • None
    • Table SQL / API
    • None

    Description

      Flink SQL> CREATE TABLE nested_type (
      >     row_type ROW<id BIGINT, data STRING>,
      >     map_type MAP<STRING, BIGINT>,
      >     array_type ARRAY<BIGINT>
      > ) WITH ('connector'='print');
      [INFO] Execute statement succeed.
      
      Flink SQL> INSERT INTO nested_type VALUES ((1, 'data'), MAP['key', 1], ARRAY[1,2,3])
      > ;
      [INFO] Submitting SQL update statement to the cluster...
      [ERROR] Could not execute SQL statement. Reason:
      org.apache.flink.table.planner.codegen.CodeGenException: Unsupported cast from 'MAP<CHAR(3) NOT NULL, INT NOT NULL> NOT NULL' to 'MAP<STRING, BIGINT>'.
      

      The query works if we change the sink table definition to :

      CREATE TABLE nested_type (
          row_type ROW<id BIGINT, data STRING>,
          map_type MAP<STRING, INT>,
          array_type ARRAY<INT>
      ) WITH (
           'connector'='print'
      );
      

      Therefore, I think the root cause of this problem is Flink SQL doesn't support cast for nested types when code generation.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jark Jark Wu
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: