Skip to content

Commit

Permalink
improve last README update about serializers and Kryo usage
Browse files Browse the repository at this point in the history
  • Loading branch information
novakov-alexey authored Dec 31, 2024
1 parent 7dc4f67 commit 6239d8c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ import org.apache.flink.api.common.typeinfo.TypeInformation
val eventStateDescriptor = new ValueStateDescriptor[Option[String]]("event",
classOf[Option[String]])
```
Although `flink-scala-api` does fallback to Kryo silently, above code example will eventually use Kryo. This may happen when old flink-scala-api is already disabled, but this Flink Scala API is not yet properly used: no serializers are used or imported from `org.apache.flinkx.api.serializers._`.
Below code example is the right way to use Scala serializers coming from this library: it completely prevents Kryo from being used. Even if `implicitly` cannot find an appropriate TypeInformation instance for your type `T`, it will fail in compile time.
Although `flink-scala-api` does not fallback to Kryo silently for Scala types, above code example will eventually use Kryo. This happens when official flink-scala-api (deprecated) is already disabled, but this Flink Scala API is not yet properly used: no serializers are used/imported from `org.apache.flinkx.api.serializers._`.
Below code example is the right way to use Scala serializers coming from this Scala API: it completely prevents Kryo from being used. Even if `implicitly` cannot find an appropriate TypeInformation instance for your type `T`, it will fail in compile time.

```scala mdoc:reset-object
import org.apache.flinkx.api.serializers._
Expand All @@ -49,8 +49,8 @@ import org.apache.flink.api.common.typeinfo.TypeInformation
val eventStateDescriptor = new ValueStateDescriptor[Option[String]]("event",
implicitly[TypeInformation[Option[String]]])
```

See more on Java types serilization here: [java-types](#java-types)
- See more on serialization with POJO serializer here: [using-a-pojo-only-flink-serialization-framework](#using-a-pojo-only-flink-serialization-framework)
- See more on Java types serilization here: [java-types](#java-types)

## Usage

Expand Down

0 comments on commit 6239d8c

Please sign in to comment.