You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Henrik Laxhuber (Jira)" <ji...@apache.org> on 2022/07/03 15:50:00 UTC

[jira] [Created] (FLINK-28367) OffsetDateTime does not work with keyBy

Henrik Laxhuber created FLINK-28367:
---------------------------------------

             Summary: OffsetDateTime does not work with keyBy
                 Key: FLINK-28367
                 URL: https://issues.apache.org/jira/browse/FLINK-28367
             Project: Flink
          Issue Type: Bug
          Components: API / DataStream, API / Type Serialization System
    Affects Versions: 1.15.0
         Environment: * Java 1.8 (openjdk 1.8.0_322)
 * Scala 2.12.15
 * Flink 1.15.0
            Reporter: Henrik Laxhuber


Using `keyBy` incorrectly (de-)serializes `java.time.OffsetDateTime` types - the offset gets lost and becomes `null`.

Here's a minimal non-working example:

 
{code:java}
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment

import java.time.OffsetDateTime

object MWE {
  def main(args: Array[String]): Unit = {
    val env = StreamExecutionEnvironment.getExecutionEnvironment

    env
      .fromElements("2022-07-03T15:35:48.142Z", "2022-07-03T15:35:48.438Z")
      .map(OffsetDateTime.parse(_))
      .keyBy((t: OffsetDateTime) => t)
      .print()

    env.execute()
  }
} {code}
 

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)