SEPURI-SAI-KRISHNA opened a new issue, #19666:
URL: https://github.com/apache/hudi/issues/19666

   ## Bug Description
   
   **What happened:**
   
   `hoodie.datasource.write.slash.separated.date.partitioning=true` is accepted 
on a table with
   more than one partition field, but the write and the query-side path 
composition disagree, so
   prefix-pruned queries silently return zero rows.
   
   For a `(datestr, city)` table written by the Avro path, 
`KeyGenUtils#getRecordPartitionPath`
   guards the substitution on `partitionPathFields.size() == 1`, so the 
directory is
   `2026-01-05/san-francisco`.
   
   On the query side, `SparkHoodieTableFileIndex#composeRelativePartitionPath` 
builds a
   `StringPartitionPathFormatter` from table config and combines only the bound 
*prefix* of the
   partition columns. A query filtering on `datestr` alone composes the 
single-part value, the
   formatter's single-field branch applies the dash-to-slash substitution, and 
the resulting
   `2026/01/05` does not exist on disk. `exists()` fails and the query returns 
nothing.
   
   `ShowHoodieTablePartitionsCommand.scala:60-61` already asserts the invariant 
this configuration
   violates:
   
   ```scala
   ValidationUtils.checkState(partitionColumnNamesOpt.get().length == 1,
     "Only one partition field is allowed for SlashEncodedPartitioning")
   ```
   
   so one code path treats single-field as a hard requirement while table 
creation accepts any
   number of fields.
   
   **What you expected:**
   
   Either the combination is rejected at table creation and in writer config 
validation, or all
   paths agree on the layout for a multi-field slash table.
   
   **Steps to reproduce:**
   1. Create a COW table partitioned by `(datestr, city)` with
      `hoodie.datasource.write.slash.separated.date.partitioning=true`.
   2. Insert a row with `datestr='2026-01-05'`, `city='san-francisco'`.
   3. `SELECT * FROM t WHERE datestr = '2026-01-05'` -- returns zero rows, 
while a query binding
      both partition columns returns the row.
   
   **Suggested fix:**
   
   Reject `slash.separated.date.partitioning=true` together with more than one 
partition field, next
   to the existing hive-style check in `HoodieCatalogTable#extraTableConfig` 
and in
   `HoodieWriterUtils.validateTableConfig` so non-SQL writers are covered too.
   
   ## Environment
   
   **Hudi version:** master (1.3.0-SNAPSHOT)
   **Query engine:** Spark
   **Relevant configs:** 
`hoodie.datasource.write.slash.separated.date.partitioning=true` with two or
   more partition fields
   
   ## Logs and Stack Trace
   
   No failure -- the query silently returns an empty result.
   


-- 
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]

Reply via email to