[FLINK-39401][formats] Port raw line-delimiter option to release-2.1#28082
Open
featzhang wants to merge 1 commit intoapache:release-2.1from
Open
[FLINK-39401][formats] Port raw line-delimiter option to release-2.1#28082featzhang wants to merge 1 commit intoapache:release-2.1from
featzhang wants to merge 1 commit intoapache:release-2.1from
Conversation
…ter option (apache#27897) Co-authored-by: Yuepeng Pan <hipanyuepeng@gmail.com> (cherry picked from commit 2379582)
Collaborator
spuru9
approved these changes
May 1, 2026
Contributor
spuru9
left a comment
There was a problem hiding this comment.
Clean cherry pick. LGTM if CI don't break in a deps gap.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Port PR #27897 (FLINK-39401) from
mastertorelease-2.1. Extends therawformat with an optionalraw.line-delimiterconfiguration that lets each Kafka/file message encode multiple records separated by a delimiter.This is a clean cherry-pick with zero conflicts — the raw format code on
release-2.1has not diverged frommasterfor the touched classes, so the backport is byte-for-byte identical to the master version (file content + tests + docs).Brief change log
RawFormatOptions: addLINE_DELIMITERConfigOption(no default, supports Java escape sequences like\n,\r\n).RawFormatFactory: read the option, register it inoptionalOptions(), and pass it to the (de)serialization schemas.RawFormatDeserializationSchema:@Nullable String lineDelimiter; the previous 4-arg constructor delegates withnullfor backward compatibility.Patternfor splitting; newdeserialize(byte[], Collector<RowData>)override emits oneRowDataper segment.RawFormatSerializationSchema:@Nullable String lineDelimiter; old 3-arg constructor delegates withnull.delimiterBytes;serialize()appends them after the value bytes.nullrow still returnsnull.docs/content/docs/connectors/table/formats/raw.mdand the Chinese mirror are updated with the new option row.Verifying this change
Added tests (unchanged from #27897):
RawFormatFactoryTest.testLineDelimiterOption— verifies the factory wires the option through correctly.RawFormatLineDelimiterTest(new, 11 tests) — covers:\n/ with multi-char / with GBK charset delimiters\n/ with custom delimiter, null rowRun locally against
release-2.1:Result:
Tests run: 52, Failures: 0, Errors: 0, Skipped: 0(11 new + 7 factory + 34 existing SerDe). All pre-existing tests continue to pass.Also ran
./mvnw spotless:check -pl flink-table/flink-table-runtime→ clean.Does this pull request potentially affect one of the following parts:
@Public(Evolving): no (new option is additive, behavior unchanged when unset)deserialize/serialize. When the option is unset, the behavior and allocations are unchanged; when set, a pre-compiledPatternand pre-computedbyte[]avoid per-record allocation.Documentation
LINE_DELIMITERoption + website docs (docs/content{,.zh}/docs/connectors/table/formats/raw.md), both ported from [FLINK-39401] Extend raw format to support line-delimiter option #27897.