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

Type mismatch when using ROW in computed column

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Table SQL / API
    • Labels:

      Description

      The following SQL:

      env.executeSql(
      	"CREATE TABLE Orders (\n"
      	+ "    order_number BIGINT,\n"
      	+ "    price        INT,\n"
      	+ "    first_name   STRING,\n"
      	+ "    last_name    STRING,\n"
      	+ "    buyer_name AS ROW(first_name, last_name)\n"
      	+ ") WITH (\n"
      	+ "  'connector' = 'datagen'\n"
      	+ ")");
      
      env.executeSql("SELECT * FROM Orders").print();
      

      Fails with:

      Exception in thread "main" java.lang.AssertionError: Conversion to relational algebra failed to preserve datatypes:
      validated type:
      RecordType(BIGINT order_number, INTEGER price, VARCHAR(2147483647) CHARACTER SET "UTF-16LE" first_name, VARCHAR(2147483647) CHARACTER SET "UTF-16LE" last_name, RecordType:peek_no_expand(VARCHAR(2147483647) CHARACTER SET "UTF-16LE" EXPR$0, VARCHAR(2147483647) CHARACTER SET "UTF-16LE" EXPR$1) NOT NULL buyer_name) NOT NULL
      converted type:
      RecordType(BIGINT order_number, INTEGER price, VARCHAR(2147483647) CHARACTER SET "UTF-16LE" first_name, VARCHAR(2147483647) CHARACTER SET "UTF-16LE" last_name, RecordType(VARCHAR(2147483647) CHARACTER SET "UTF-16LE" EXPR$0, VARCHAR(2147483647) CHARACTER SET "UTF-16LE" EXPR$1) NOT NULL buyer_name) NOT NULL
      rel:
      LogicalProject(order_number=[$0], price=[$1], first_name=[$2], last_name=[$3], buyer_name=[ROW($2, $3)])
        LogicalTableScan(table=[[default_catalog, default_database, Orders]])
      
      	at org.apache.calcite.sql2rel.SqlToRelConverter.checkConvertedType(SqlToRelConverter.java:467)
      	at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:582)
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              twalthr Timo Walther
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: