This is an automated email from the ASF dual-hosted git repository.

leonardBang pushed a commit to branch release-1.20
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.20 by this push:
     new 0d5215687db [FLINK-39672][docs] Document Java records as supported 
POJO types
0d5215687db is described below

commit 0d5215687db0f34fef5463081d4edfa6605f7e6d
Author: Mingliang Liu <[email protected]>
AuthorDate: Tue May 19 23:49:08 2026 -0700

    [FLINK-39672][docs] Document Java records as supported POJO types
    
    This closes  #28179.
    
    Generated-by: Claude Opus 4.7
---
 docs/content.zh/docs/deployment/java_compatibility.md              | 3 +++
 .../datastream/fault-tolerance/serialization/schema_evolution.md   | 2 ++
 .../fault-tolerance/serialization/types_serialization.md           | 7 +++++++
 docs/content/docs/deployment/java_compatibility.md                 | 4 +++-
 .../datastream/fault-tolerance/serialization/schema_evolution.md   | 2 ++
 .../fault-tolerance/serialization/types_serialization.md           | 7 +++++++
 6 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/docs/content.zh/docs/deployment/java_compatibility.md 
b/docs/content.zh/docs/deployment/java_compatibility.md
index f2e4cb93eb4..423d68d1f4d 100644
--- a/docs/content.zh/docs/deployment/java_compatibility.md
+++ b/docs/content.zh/docs/deployment/java_compatibility.md
@@ -52,6 +52,9 @@ The following Flink features have not been tested with Java 
11:
 
 Experimental support for Java 17 was added in 1.18.0. 
([FLINK-15736](https://issues.apache.org/jira/browse/FLINK-15736))
 
+Support for Java Records was added in Flink 1.19 
([FLINK-32380](https://issues.apache.org/jira/browse/FLINK-32380)).
+Java records are handled as [POJO types]({{< ref 
"docs/dev/datastream/fault-tolerance/serialization/types_serialization" 
>}}#pojos) and serialized via their canonical constructor.
+
 ### Untested Flink features
 
 These Flink features have not been tested with Java 17:
diff --git 
a/docs/content.zh/docs/dev/datastream/fault-tolerance/serialization/schema_evolution.md
 
b/docs/content.zh/docs/dev/datastream/fault-tolerance/serialization/schema_evolution.md
index 2d7f29d18c1..b8307623d79 100644
--- 
a/docs/content.zh/docs/dev/datastream/fault-tolerance/serialization/schema_evolution.md
+++ 
b/docs/content.zh/docs/dev/datastream/fault-tolerance/serialization/schema_evolution.md
@@ -85,6 +85,8 @@ Flink 基于下面的规则来支持 [POJO 类型]({{< ref "docs/dev/datastream/
  3. 不可以修改字段的声明类型。
  4. 不可以改变 POJO 类型的类名,包括类的命名空间。
 
+上述规则同样适用于 [Java records]({{< ref 
"docs/dev/datastream/fault-tolerance/serialization/types_serialization" 
>}}#pojos),自 Flink 1.19 起 records 被作为 POJO 类型处理。
+
 需要注意,只有从 1.8.0 及以上版本的 Flink 生产的 savepoint 进行恢复时,POJO 类型的状态才可以进行升级。
 对 1.8.0 版本之前的 Flink 是没有办法进行 POJO 类型升级的。
 
diff --git 
a/docs/content.zh/docs/dev/datastream/fault-tolerance/serialization/types_serialization.md
 
b/docs/content.zh/docs/dev/datastream/fault-tolerance/serialization/types_serialization.md
index 70679c5888d..32e314d60dd 100644
--- 
a/docs/content.zh/docs/dev/datastream/fault-tolerance/serialization/types_serialization.md
+++ 
b/docs/content.zh/docs/dev/datastream/fault-tolerance/serialization/types_serialization.md
@@ -108,6 +108,9 @@ Java and Scala classes are treated by Flink as a special 
POJO data type if they
 
 - The type of a field must be supported by a registered serializer.
 
+[Java 
records](https://docs.oracle.com/en/java/javase/17/language/records.html) are 
also recognized as POJO types since Flink 1.19 
([FLINK-32380](https://issues.apache.org/jira/browse/FLINK-32380)).
+A `public` record class is serialized by `PojoSerializer` through its 
canonical constructor; the no-argument constructor and getter/setter 
requirements above do not apply.
+
 POJOs are generally represented with a `PojoTypeInfo` and serialized with the 
`PojoSerializer` (using [Kryo](https://github.com/EsotericSoftware/kryo) as 
configurable fallback).
 The exception is when the POJOs are actually Avro types (Avro Specific 
Records) or produced as "Avro Reflect Types". 
 In that case the POJO's are represented by an `AvroTypeInfo` and serialized 
with the `AvroSerializer`.
@@ -314,6 +317,10 @@ conditions are fulfilled:
   or have a public getter- and a setter- method that follows the Java beans
   naming conventions for getters and setters.
 
+Java records are also recognized as POJO types.
+The class must still be `public`, but the no-argument constructor and 
getter/setter rules above are waived.
+Java records are instantiated via their canonical constructor.
+
 Note that when a user-defined data type can't be recognized as a POJO type, it 
must be processed as GenericType and
 serialized with Kryo.
 
diff --git a/docs/content/docs/deployment/java_compatibility.md 
b/docs/content/docs/deployment/java_compatibility.md
index 2f63c50f52a..dbc408e23e1 100644
--- a/docs/content/docs/deployment/java_compatibility.md
+++ b/docs/content/docs/deployment/java_compatibility.md
@@ -51,7 +51,9 @@ The following Flink features have not been tested with Java 
11:
 ## Java 17
 
 Experimental support for Java 17 was added in 1.18. 
([FLINK-15736](https://issues.apache.org/jira/browse/FLINK-15736))
-In Flink 1.19, we added support for Java Records. 
([FLINK-32380](https://issues.apache.org/jira/browse/FLINK-32380))
+
+Support for Java Records was added in Flink 1.19 
([FLINK-32380](https://issues.apache.org/jira/browse/FLINK-32380)).
+Java records are handled as [POJO types]({{< ref 
"docs/dev/datastream/fault-tolerance/serialization/types_serialization" 
>}}#pojos) and serialized via their canonical constructor.
 
 ### Untested Flink features
 
diff --git 
a/docs/content/docs/dev/datastream/fault-tolerance/serialization/schema_evolution.md
 
b/docs/content/docs/dev/datastream/fault-tolerance/serialization/schema_evolution.md
index 128633b5a4d..d5ea3c798ff 100644
--- 
a/docs/content/docs/dev/datastream/fault-tolerance/serialization/schema_evolution.md
+++ 
b/docs/content/docs/dev/datastream/fault-tolerance/serialization/schema_evolution.md
@@ -95,6 +95,8 @@ based on the following set of rules:
  3. Declared fields types cannot change.
  4. Class name of the POJO type cannot change, including the namespace of the 
class.
 
+The same rules apply to [Java records]({{< ref 
"docs/dev/datastream/fault-tolerance/serialization/types_serialization" 
>}}#pojos), which Flink treats as POJO types since Flink 1.19.
+
 Note that the schema of POJO type state can only be evolved when restoring 
from a previous savepoint with Flink versions
 newer than 1.8.0. When restoring with Flink versions older than 1.8.0, the 
schema cannot be changed.
 
diff --git 
a/docs/content/docs/dev/datastream/fault-tolerance/serialization/types_serialization.md
 
b/docs/content/docs/dev/datastream/fault-tolerance/serialization/types_serialization.md
index 4b3dc6f76c2..6f2d61ac693 100644
--- 
a/docs/content/docs/dev/datastream/fault-tolerance/serialization/types_serialization.md
+++ 
b/docs/content/docs/dev/datastream/fault-tolerance/serialization/types_serialization.md
@@ -109,6 +109,9 @@ Java and Scala classes are treated by Flink as a special 
POJO data type if they
 
 - The type of a field must be supported by a registered serializer.
 
+[Java 
records](https://docs.oracle.com/en/java/javase/17/language/records.html) are 
also recognized as POJO types since Flink 1.19 
([FLINK-32380](https://issues.apache.org/jira/browse/FLINK-32380)).
+A `public` record class is serialized by `PojoSerializer` through its 
canonical constructor; the no-argument constructor and getter/setter 
requirements above do not apply.
+
 POJOs are generally represented with a `PojoTypeInfo` and serialized with the 
`PojoSerializer` (using [Kryo](https://github.com/EsotericSoftware/kryo) as 
configurable fallback).
 The exception is when the POJOs are actually Avro types (Avro Specific 
Records) or produced as "Avro Reflect Types". 
 In that case the POJO's are represented by an `AvroTypeInfo` and serialized 
with the `AvroSerializer`.
@@ -341,6 +344,10 @@ conditions are fulfilled:
   or have a public getter- and a setter- method that follows the Java beans
   naming conventions for getters and setters.
 
+Java records are also recognized as POJO types.
+The class must still be `public`, but the no-argument constructor and 
getter/setter rules above are waived.
+Java records are instantiated via their canonical constructor.
+
 Note that when a user-defined data type can't be recognized as a POJO type, it 
must be processed as GenericType and
 serialized with Kryo.
 

Reply via email to