[common] Fix CHAR min/max statistics collection - #4080
Open
beetle0915 wants to merge 4 commits into
Open
Conversation
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.
Purpose
Linked issue: close #4066
DataTypeChecks.isSupportedStatisticsType()listsCHARas a supportedstatistics type, but
LogRecordBatchStatisticsCollectordoes not handleCHARwhen collecting min/max values. As a result, the bounds remain nulland predicates on
CHARcolumns cannot prune record batches.LogRecordBatchStatisticsWriteralso does not handle non-nullCHARmin/max values, so adding collector support alone would cause statistics
serialization to fail.
Brief change log
CHARmin/max collection usingInternalRow#getChar,BinaryString::compareTo, andBinaryString::copy.CHARstatistics serialization usingAlignedRowWriter#writeChar.and a value shorter than the declared
CHARlength.CHARcolumn.Tests
LogRecordBatchStatisticsCollectorTest#testCharStatisticsSerializationRoundTrip:verifies that
CHAR(3)values, including the shorter value"a", arecollected and serialized with the expected min/max values and null count.
RecordBatchFilterTest#testCharStatisticsCanPruneRecordBatch:verifies that
CHARstatistics can exclude a record batch that cannotsatisfy the predicate.
mvn spotless:check -pl fluss-common,fluss-serverpasses.API and Format
No public API or statistics format change.
The implementation uses the existing
CHARinternal representation andstatistics serialization format.
Documentation
No documentation change; behavior-only bug fix.
Assisted by: OpenAI Codex following the guidelines.