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

SqlTimestamp has lag when convert long to Timestamp

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 1.10.0
    • None
    • Table SQL / API

    Description

      When I set rowtime attribute by using expression 'column.rowtime' , and result type is sql.Timestamp, the result will have lag which is equals with default timezone offset.

      tEnv.fromDataStream(stream, "user_action_time.rowtime, user_name, data");
      

      I look into the conversion logic, the field was go through 'long -> SqlTimestamp -> Timestamp' conversion.

      long from = System.currentTimeMillis();
      long to = SqlTimestamp
      			.fromEpochMillis(from)
      			.toTimestamp()
      			.getTime();
      

      The result is from!=to. In SqlTimestamp.toTimestamp() using Timestamp.valueOf(LocalDateTime dateTime) which is contain timezone infomation, will casue time lag.

      From Timestamp to Timestamp not have this issue, but convert Datastream to Table is use StreamRecord.timestamp as rowtime field.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              liuyufei YufeiLiu
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: