github-actions[bot] commented on code in PR #61076:
URL: https://github.com/apache/doris/pull/61076#discussion_r2900567785
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonUtil.java:
##########
@@ -565,15 +578,21 @@ private static String
serializePartitionValue(org.apache.paimon.types.DataType t
return null;
}
return value.toString();
- // case binary, varbinary should not supported, because if return
string with utf8,
+ // case binary:
+ // case varbinary: should not supported, because if return string
with utf8,
// the data maybe be corrupted
case DATE:
if (value == null) {
return null;
}
- // Paimon date is stored as days since epoch
- LocalDate date = LocalDate.ofEpochDay((Integer) value);
- return date.format(DateTimeFormatter.ISO_LOCAL_DATE);
+ // When partition.legacy-name = true (default), Paimon date is
stored as days since epoch
+ // When partition.legacy-name = false, the value is already a
human read date string
+ if (legacyPartitionName) {
+ LocalDate date = LocalDate.ofEpochDay((Integer) value);
+ return date.format(DateTimeFormatter.ISO_LOCAL_DATE);
+ } else {
+ return value.toString();
+ }
Review Comment:
**Potential Bug**: The `value` here comes from
`RowDataToObjectArrayConverter.convert()` which always returns an `Integer`
(days since epoch) for DATE columns, regardless of the `partition.legacy-name`
setting. The `partition.legacy-name` option only affects how Paimon formats
partition path names in `InternalRowPartitionComputer.generatePartValues()`,
not the binary-level storage.
So `value.toString()` on an `Integer` would produce `"20513"` (epoch days)
instead of `"2026-03-01"` (the human-readable date). This would cause incorrect
partition values during runtime filter partition pruning.
I believe the `serializePartitionValue` method should always convert the
DATE value the same way regardless of `legacyPartitionName`, since its input is
always the raw binary representation:
```java
case DATE:
if (value == null) {
return null;
}
// Value from RowDataToObjectArrayConverter is always an Integer (days
since epoch)
LocalDate date = LocalDate.ofEpochDay((Integer) value);
return date.format(DateTimeFormatter.ISO_LOCAL_DATE);
```
The `legacyPartitionName` distinction is only needed in
`generatePartitionInfo` where input comes from `Partition.spec()` (which
returns already-formatted strings).
--
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]