Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#187 Documents state migration #188

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ This project is a community-maintained fork of official Apache Flink Scala API,
`flink-scala-api` uses a different package name for all api-related classes like `DataStream`, so you can do
gradual migration of a big project and use both upstream and this versions of scala API in the same project.

### API

The actual migration should be straightforward and simple, replace old import to the new ones:
```scala
// original api import
Expand All @@ -24,6 +26,18 @@ import org.apache.flinkx.api._
import org.apache.flinkx.api.serializers._
```

### State

`flink-scala-api` generates at compile-time specific TypeInformation & TypeSerializer. To use them for state serialization, ensure to replace state descriptor constructors using `Class[T]` param with constructors using `TypeInformation[T]` param:
novakov-alexey marked this conversation as resolved.
Show resolved Hide resolved
```scala
novakov-alexey marked this conversation as resolved.
Show resolved Hide resolved
// state using Kryo
val eventStateDescriptor = new ValueStateDescriptor[Event]("event", classOf[Event])
```
```scala
// state using flink-scala-api
val eventStateDescriptor = new ValueStateDescriptor[Event]("event", implicitly[TypeInformation[Event]])
```

## Usage

`flink-scala-api` is released to Maven-central for 2.13 and 3. For SBT, add this snippet to `build.sbt`:
Expand Down