test(spark): characterize PartitionPathUtils partition discovery and materialization#8783
Open
jackylee-ch wants to merge 1 commit 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.
Rationale for this change
PartitionPathUtils(java/vortex-spark/src/main/java/dev/vortex/spark/read/PartitionPathUtils.java)discovers Hive-style partition columns from file paths and materializes them as constant
column vectors on the read path. It currently has no test coverage, despite encoding
several subtle behaviors: URL decoding of keys and values, the
__HIVE_DEFAULT_PARTITION__null sentinel, first-=splitting, type inferenceprecedence (int → long → double → boolean → string), and per-type parsing into
ConstantColumnVector. This continues the characterization-test series from #8770(read-path
ArrowUtils) and #8782 (write-pathSparkToArrowSchema).What changes are included in this PR?
A new
PartitionPathUtilsTestcovering all three public methods:parsePartitionValues: extracts orderedkey=valuesegments from paths; ignoressegments without the
key=valueshape (including empty keys or values); URL-decodesboth keys and values (
New%20York→New York); splits on the first=so valuesmay themselves contain
=.inferPartitionColumnType: infersIntegerfor int-width values,Longforwider integrals,
Doublefor decimal-point values,Booleanfor case-insensitivetrue/false, and falls back to
String(including for null and the__HIVE_DEFAULT_PARTITION__sentinel).createConstantVector: null and the Hive default-partition sentinel produce nullvectors; string/int/long/short/byte/boolean/float/double values are parsed into their
target types;
DateTypeparses as days-since-epoch (int) and both timestamp types asmicros-since-epoch (long); unrecognized target types fall back to UTF8 strings.
This is a test-only change; no production code is modified. 19 tests, all passing
locally (
:vortex-spark_2.12:test --tests 'dev.vortex.spark.read.PartitionPathUtilsTest').What APIs are changed? Are there any user-facing changes?
None. No production code or public API is touched.