fix: serialize AST join, sample and interleave helpers - #2753
Merged
manticore-projects merged 1 commit intoOct 2, 2026
Merged
Conversation
Signed-off-by: 付典 <fudianchn@gmail.com>
fudianchn
marked this pull request as ready for review
October 2, 2026 07:26
Contributor
|
Thank you! |
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.
AI disclosure: this change was prepared with AI coding agents, reviewed and revised line by line by me.
What
Make
JoinHint,SampleClauseandSpannerInterleaveInserializable so ASTs containing these helpers can be copied with Java object streams.Why
Serializing a parsed SELECT with a join hint or sampling clause, or a CREATE TABLE with Spanner interleaving, currently throws
NotSerializableException. Ordinary SELECT and CREATE TABLE ASTs serialize successfully.How
Serializableto the three helper classes, following the existing helper-model convention.SerializationTestwith parsed-SQL object-stream round trips and assertions for helper fields, adjacent AST fields and copy independence.Root cause
Joinand sampling owners inherit serializability throughASTNodeAccessImpl;CreateTableimplementsStatement, whoseModelparent is serializable. Their non-transient helper fields refer to three classes that do not implementSerializable, breaking those object graphs.Testing
SerializationTesthas 25 cases: on basebb55bb9d, 22 fail with the scopedNotSerializableExceptionand three normal controls pass; the fix passes all 25. Tests cover SQL Server/Doris hint positions, sampling enum/value/flag fields, Table/ParenthesedSelect/ParenthesedFromItem/MatchRecognize sampling owners, Spanner delete actions and deep-copy independence after AST mutation.JoinHintorSpannerInterleaveInmarker rejects seven or three cases in the original 24-case matrix. Deleting theSampleClausemarker rejects 13 cases in the final 25-case matrix. All normal controls pass in every mutation run.checkpasses with 9,426 cases, zero failures/errors and 25 skipped; Mavenclean verify spotless:checkpasses with 9,408 cases, zero failures/errors and 25 skipped. Formatting, Checkstyle, PMD, SpotBugs, grammar ambiguity, applicable coverage and strict changed-file license checks pass.Behavior notes
Verification of the original issue
No existing issue is linked. The failures were reproduced on upstream master
bb55bb9de8377de9880b14e4fe3b3cc94bf63498; the fixed commit is3e220711767d6b71574a87bd7786225b6f925da9. This follows the model-serialization contract discussed in #2144, which fixedWithItemand invited additional model fixes.Each parsed AST fails serialization on the base commit and completes an ObjectOutputStream/ObjectInputStream round trip with the fix. The tests also assert helper values and neighboring AST fields.