SEPURI-SAI-KRISHNA opened a new pull request, #19706:
URL: https://github.com/apache/hudi/pull/19706
### Describe the issue this Pull Request addresses
Closes #19705.
`PartitionPathParser#getPartitionValues` splits the partition path on `/`
and consumes exactly one
segment per partition field, unless the field is time-based. The
multi-directory case is handled
only for `DATE`, `TIMESTAMP` and `TIME` (`isTimeBasedType`), so under
`hoodie.datasource.write.slash.separated.date.partitioning=true` a partition
column declared
`STRING` — an ordinary way to hold a `yyyy-MM-dd` value, and what the
feature's own test table uses
— produces the directory `2026/01/05`, and the parser reads the value back
as `2026`. The remaining
segments are silently dropped.
This is not the Spark read path —
`HoodieSparkUtils#doParsePartitionColumnValues` handles the slash
layout, which is why the datasource tests pass. `PartitionPathParser` is the
engine-agnostic parser,
reached from `HoodieFileGroupReader` when a bootstrap table merges skeleton
and data files, so the
truncated value is handed to `convertValueToEngineType` and materialized
into the returned records.
Calling `getPartitionFieldVals` directly against a schema with two string
fields and one date field:
| partition path | partition fields | before | after |
|---|---|---|---|
| `2026/01/05` | `[string_field]` | `[2026]` | `[2026-01-05]` |
| `2026/01` | `[string_field]` | `[2026]` | `[2026-01]` |
| `2026/01/05` | `[date_field]` | `[2026-01-05]` | `[2026-01-05]` |
| `2026-01-05` | `[string_field]` | `[2026-01-05]` | `[2026-01-05]` |
### Summary and Changelog
The parser now undoes the `-` -> `/` substitution the writer performed, when
told the table uses it.
* `PartitionPathParser#getPartitionFieldVals` gains an overload taking a
`slashSeparatedDatePartitioning` flag. The existing three-argument
signature is kept and delegates
with `false`, so nothing outside this PR changes behavior.
* The non-time-typed branch consumes `parts.length - partitionFields.length
+ 1` segments and
rejoins them with `-`, mirroring the way `inferDateValue` already consumes
them for a time-based
column. For a value that was not slash-separated the count is 1 and the
segment is used as-is.
* The rejoin is confined to a table partitioned by a **single** column,
mirroring the guard in
`KeyGenUtils#getRecordPartitionPath` that decides when the writer
slash-separates at all.
Multi-field slash partitioning produces a layout that cannot be lined up
with the partition
columns in the first place; that is tracked in #19666 and left alone here.
* `HoodieFileGroupReader` passes
`metaClient.getTableConfig().getSlashSeparatedDatePartitioning()`
at its call site. `metaClient` is already a field, so no constructor
change was needed.
Tests in `TestPartitionPathParser`: a new parameterized case set covering
the rejoin, a value with
no dash, `__HIVE_DEFAULT_PARTITION__`, a time-based column (unchanged), and
a multi-field path
(unchanged); plus a case pinning the pre-existing behavior when the flag is
not set, so the default
path stays covered. The existing inline schema was lifted into a
`testSchema()` helper shared by
both tests.
The new cases fail on the unfixed code with `expected: <2026-01-05> but was:
<2026>` and
`expected: <2026-01> but was: <2026>`.
### Impact
A bootstrap table using
`hoodie.datasource.write.slash.separated.date.partitioning` with a
non-time-typed partition column returns the real partition value instead of
the first path segment.
No behavior change otherwise: the new branch is reached only through the new
overload, and the only
caller passes a table config that defaults to `false`. The three-argument
`getPartitionFieldVals` keeps its exact current behavior, so any out-of-tree
caller is unaffected.
### Risk Level
low
One branch in one method, gated on a config that defaults to false, plus one
call site. Verified
with `TestPartitionPathParser` (29 tests, all passing) and by re-running the
new cases against the
unfixed code to confirm they fail there.
### Documentation Update
none
### Contributor's checklist
- [x] Read through [contributor's
guide](https://hudi.apache.org/contribute/how-to-contribute)
- [x] Enough context is provided in the sections above
- [x] Adequate tests were added if applicable
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]