deepakpanda93 commented on issue #17357: URL: https://github.com/apache/hudi/issues/17357#issuecomment-5239903713
Closing — the documentation update this issue asks for was merged in #19555 (merge commit 2f77af6) and is live on the site. **What changed.** Two edits to the *Create partitioned table* section of the SQL DDL page: 1. **Corrected the example.** It declared `(id, name, dt, hh)` with `PARTITIONED BY (dt)`, leaving `hh` after the partition column — the exact shape that triggers this bug, so anyone following the page reproduced it. The clause is now `PARTITIONED BY (dt, hh)`. The schema is untouched: with both columns partitioned they are already trailing, in declaration order, so nothing is reordered. 2. **Added a `:::caution`** stating that partition columns must be declared last, with the resulting stored column order and both failure modes. **Both failure modes are documented**, because only one of them is loud. Declaring `(id, name, price, dt, ts)` with `PARTITIONED BY (dt)` stores the table as `(id, name, price, ts, dt)`. A positional `INSERT INTO ... SELECT` then fails with `INCOMPATIBLE_DATA_FOR_TABLE.CANNOT_SAFELY_CAST` when the shifted types are incompatible — the `ts` cast error in the issue description. When the shifted types happen to be compatible there is no error at all: the insert returns exit 0 having written the partition value into a data column and a data value into the partition. The caution calls out the silent case explicitly, and notes that naming columns explicitly (`INSERT INTO tbl (id, name, price, dt, ts) SELECT ...`) avoids the mismatch on an already-mis-declared table. Worth recording for anyone who finds this later: getting the `PARTITIONED BY` *order* wrong fails loudly at analysis via `HoodieSchemaUtils.checkPartitionSchemaOrder`, whereas getting the *declaration* order wrong — the subject of this issue — is validated by nothing. That asymmetry is why documentation was the right fix here rather than a louder error. **Coverage.** `website/docs/sql_ddl.md` (next) plus every 1.x versioned copy that exists: 1.0.0, 1.0.1, 1.0.2, 1.1.1, and 1.2.0. Verified rendering at `/docs/sql_ddl` and `/docs/next/sql_ddl`. **On the referenced PR.** #12577 was closed without merging — it only added a test reproducing the problem, with all three insert variants commented out as "None of these queries work". There was no code fix to describe, and this issue was filed as a `[Doc update]` task, so documenting current behaviour is the requested outcome. -- 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]
