github-actions[bot] commented on code in PR #65219:
URL: https://github.com/apache/doris/pull/65219#discussion_r3636918182
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/ExprToStringValueVisitor.java:
##########
@@ -57,7 +57,14 @@ public String visitDateLiteral(DateLiteral expr,
StringValueContext ctx) {
if (expr.getType().isTimeStampTz()) {
try {
ZoneId dorisZone = DateUtils.getTimeZone();
- String offset =
dorisZone.getRules().getOffset(java.time.Instant.now()).toString();
+ // Compute offset from the target instant (the literal's UTC
value),
+ // not Instant.now() which may be in a different DST period.
+ java.time.Instant targetInstant = java.time.LocalDateTime.of(
+ (int) expr.getYear(), (int) expr.getMonth(), (int)
expr.getDay(),
+ (int) expr.getHour(), (int) expr.getMinute(), (int)
expr.getSecond(),
+ (int) expr.getMicrosecond() * 1000)
+ .atZone(java.time.ZoneOffset.UTC).toInstant();
+ String offset =
dorisZone.getRules().getOffset(targetInstant).toString();
Review Comment:
[P2] Keep rendered offsets within the downstream parser contract
A historical regional offset can include seconds: in an `Asia/Shanghai`
session, the supported value `1900-01-01T00:00:00Z` is rendered here as
`1900-01-01 08:05:43+08:05:43`. This visitor also feeds the group-commit and
transactional-insert `PDataRow` paths, but BE's TIMESTAMPTZ parser consumes
only an hour/minute offset (and restricts minutes to `00`, `30`, or `45`), so
that valid literal is rejected instead of inserted. Please serialize an
instant-bearing form the BE parser can round-trip (for example UTC in
stream-load contexts), or extend the parser to accept exact historical offsets,
and add transactional-insert coverage for a pre-standard-offset instant.
--
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]