metanil commented on PR #55885:
URL: https://github.com/apache/spark/pull/55885#issuecomment-7059292506

   @sunchao thanks for review!
   
   **1. Collation.** Good catch, and confirmed: with `s STRING COLLATE 
UTF8_LCASE` and the rows `U+0130` and `i U+0307`, `truncate(s, 1)` gives 
`count(*) OVER (PARTITION BY s)` of 1, 1 instead of 2, 2, and `GROUP BY s` 
gives two groups of 1, with no shuffle. That said, it turns out this isn't 
specific to truncate. Master already gets the same query wrong for any 
non-identity transform it reports over a collated column: `bucket(5, s)` gives 
1, 1, and since it hashes the raw bytes, even plain `'A'` and `'a'` trip it; a 
parameterless `prefix1(s)` behaves exactly like truncate. `identity(s)` is fine 
on both, since partition keys are compared with the collation, and equi-joins 
on `s` are fine everywhere, since they're planned over collation keys and 
shuffle. So this PR widens an existing hole rather than opening a new one, and 
the real fix belongs in clustering for all transforms, not just truncate. I 
filed it as [SPARK-62150](https://issues.apache.org/jira/browse/SPARK-62150) 
with the ma
 ster repro: a non-identity transform over a column that isn't binary stable 
would no longer satisfy a clustering on it. Since that changes `bucket`'s 
behavior on master too, I'd rather keep it as its own change, so it can be 
backported on its own. Personally I think the two can land independently 
without blocking each other, whichever goes first. Does that work for you?


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to