Skip to content

Commit

Permalink
[FLINK-34123][docs][type] Add doc for built-in serialization support …
Browse files Browse the repository at this point in the history
…for Map, List, and Collection
  • Loading branch information
X-czh authored and reswqa committed May 27, 2024
1 parent 73676da commit f860631
Showing 1 changed file with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ Flink places some restrictions on the type of elements that can be in a DataStre
The reason for this is that the system analyzes the types to determine
efficient execution strategies.

There are seven different categories of data types:
There are eight different categories of data types:

1. **Java Tuples** and **Scala Case Classes**
2. **Java POJOs**
3. **Primitive Types**
4. **Regular Classes**
5. **Values**
6. **Hadoop Writables**
7. **Special Types**
4. **Common Collection Types**
5. **Regular Classes**
6. **Values**
7. **Hadoop Writables**
8. **Special Types**

#### Tuples and Case Classes

Expand Down Expand Up @@ -167,6 +168,20 @@ input.keyBy(_.word)

Flink supports all Java and Scala primitive types such as `Integer`, `String`, and `Double`.

#### Common Collection Types

Flink comes with dedicated serialization support for common Java collection types, which is more efficient than going
through a general purpose serialization framework. Currently, only `Map`, `List` and its super interface `Collection`
are supported. To utilize it, you need to declare the collection type with:

1. Concrete type arguments: e.g. `List<String>` but not `List`, `List<T>`, or `List<?>`, as Flink needs them to dispatch
serialization of the element types.
2. Interface types: e.g. `List<String>` but not `LinkedList<String>`, as Flink does not preserve the underlying
implementation types across serialization.

Other nonqualified collection types will be handled by Flink as general class types. If the implementation types are
also required to be preserved, you also need to register it with a custom serializer.

#### General Class Types

Flink supports most Java and Scala classes (API and custom).
Expand Down

0 comments on commit f860631

Please sign in to comment.