Repository navigation
[hive] Return null for array subscripts outside bounds - #11360
Open
zhangyue19921010 wants to merge 1 commit into
Open
zhangyue19921010 wants to merge 1 commit into
zhangyue19921010 wants to merge 1 commit into
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
Fixes #11359.
Return NULL for array subscripts outside the bounds, matching Hive's standard list inspector. A direct projection such as
SELECT arr[-1] FROM tcurrently fails on an ordinary append table when Hive evaluates the subscript against the Paimon list inspector.Check the index before accessing the internal array. Valid elements, NULL arrays, and NULL elements keep their existing behavior.
Tests
HiveOnMrReadITCase#testArraySubscriptOutsideBounds: direct Hive query over an ordinary append table, including valid indices, negative and oversized indices, empty arrays, and NULL arrays. The query fails before the fix.PaimonListObjectInspectorTest: actual Hive index UDF, standard-inspector comparison, integer boundary indices, generic and binary arrays, and NULL inputs.This run passed all nine scoped Maven tests (eight inspector cases and the direct SQL regression) with Checkstyle, Spotless, and Enforcer enabled. A separately compiled copy of the unchanged current-base inspector reproduces the direct SQL failure.
Validated with Hive 2.3.10 on JDK 11. An earlier broader run at the same final commit passed 49 tests, including all eight list-inspector cases and the direct SQL regression, with Checkstyle, Spotless, and Enforcer enabled. Three unchanged SerDe tests encountered Parquet classpath linkage errors; all three passed in a separate JUnit Platform run with matching Parquet 1.16.0 classes first. The affected module's source RAT check also passed.