wombatu-kun opened a new pull request, #8759:
URL: https://github.com/apache/paimon/pull/8759

   ### Purpose
   
   Implements the long-standing TODO in 
`SortCodeGenerator.supportNormalizedKey` 
(`paimon-codegen/src/main/scala/org/apache/paimon/codegen/SortCodeGenerator.scala:414`):
 support a normalized sort key for non-compact `TIMESTAMP` (precision > 3), 
which was previously skipped.
   
   How it works: a non-compact timestamp is encoded as a 12-byte normalized key 
- 8 bytes for `millisecond` followed by 4 bytes for `nanoOfMillisecond` (range 
`[0, 999999]`), most-significant-first, so unsigned byte comparison matches 
`Timestamp.compareTo` (millisecond then nano). The 12-byte key fully determines 
order. Compact timestamps keep their existing 8-byte encoding.
   
   - `supportNormalizedKey` returns true for `TIMESTAMP_WITHOUT_TIME_ZONE`;
   - `getNormalizeKeyLen` returns 12 for non-compact timestamps;
   - `SortUtil.putTimestampNormalizedKey` writes both the millisecond and the 
nanoOfMillisecond, respecting a truncated key budget.
   
   ### Tests
   
   New `NormalizedKeyComputerTest`:
   
   - key metadata: compact `TIMESTAMP(3)` = 9 bytes; non-compact 
`TIMESTAMP(4|6|9)` = 13 bytes and fully determines order;
   - sub-millisecond ordering (same millisecond, different nanoOfMillisecond);
   - exhaustive pairwise sign-match of `compareKey` against 
`Timestamp.compareTo`;
   - end-to-end sort through `BinaryInMemorySortBuffer`.
   
   `CodeGenUtilsTest` and `BinaryExternalSortBufferTest` remain green.
   


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