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

Generic type can not be matched when convert table to stream.

    XMLWordPrintableJSON

    Details

      Description

      The query result schema printed by table.printSchema():

       |-- deviceId: BIGINT
       |-- channel: STRING
       |-- schemaId: BIGINT
       |-- productId: BIGINT
       |-- schema: LEGACY('RAW', 'ANY<com.yunmo.iot.schema.Schema>')
      

      then excuting table.toRetractStream[DeviceSchema].print(), exception throwed:

      Exception in thread "main" org.apache.flink.table.api.ValidationException: Field types of query result and registered TableSink do not match.
       Query schema: [deviceId: BIGINT, channel: STRING, schemaId: BIGINT, productId: BIGINT, schema: RAW('com.yunmo.iot.schema.Schema', ?)]
       Sink schema: [deviceId: BIGINT, channel: STRING, schemaId: BIGINT, productId: BIGINT, schema: LEGACY('RAW', 'ANY<com.yunmo.iot.schema.Schema>')]

      The com.yunmo.iot.schema.Schema is a generic type.

      The schema field of Query schema change from LEGACY('RAW' to RAW, but the Sink schema still a LEGACY('RAW'

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jark Jark Wu
                Reporter:
                xiemeilong xiemeilong
              • Votes:
                0 Vote for this issue
                Watchers:
                4 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