Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-7594 Add a SQL client
  3. FLINK-8853

SQL Client cannot emit query results that contain a rowtime attribute

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Blocker
    • Resolution: Duplicate
    • 1.5.0
    • None
    • Table SQL / Client
    • None

    Description

      Emitting a query result that contains a rowtime attribute fails with the following exception:

      Caused by: java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.lang.Long
          at org.apache.flink.api.common.typeutils.base.LongSerializer.serialize(LongSerializer.java:27)
          at org.apache.flink.api.java.typeutils.runtime.RowSerializer.serialize(RowSerializer.java:160)
          at org.apache.flink.api.java.typeutils.runtime.RowSerializer.serialize(RowSerializer.java:46)
          at org.apache.flink.api.java.typeutils.runtime.TupleSerializer.serialize(TupleSerializer.java:125)
          at org.apache.flink.api.java.typeutils.runtime.TupleSerializer.serialize(TupleSerializer.java:30)
          at org.apache.flink.streaming.experimental.CollectSink.invoke(CollectSink.java:66)
          ... 44 more

      The problem is cause by the ResultStore which configures the CollectionSink with the field types obtained from the TableSchema. The type of the rowtime field is a TimeIndicatorType which is serialized as Long. However, in the query result it is represented as Timestamp. Hence, the type must be replaced by a SqlTimeTypeInfo<Timestamp>.

      Attachments

        Activity

          People

            twalthr Timo Walther
            fhueske Fabian Hueske
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: