fengstack commented on PR #18726: URL: https://github.com/apache/dolphinscheduler/pull/18726#issuecomment-6337866113
Thanks @SbloodyS! Updated in commit 0c60e854a9. `findFormatOffsetIndex` no longer selects a sign by `+`/`-` precedence: it scans left to right and takes the **first sign whose entire remainder is a complete arithmetic operand** (arithmetic characters only, and neither a timezone literal nor starting with one). Signs rejected as format literals are skipped and the scan continues, so a timezone literal followed by an offset keeps both, and unary signs inside the operand stay part of the arithmetic. Both reported cases now behave as expected (business date 2022-09-01 00:00:00): - `$[month_first_day(yyyy-MM-dd'T'HH:mm:ss+08:00-1)]` => `2022-08-01T00:00:00+08:00` (the `+08:00` fails the arithmetic check, the trailing `-1` is the offset) - `$[month_first_day(yyyy-MM-dd-7*-1)]` => `2022-09-01` (boundary at the first `-`, the complete operand `7*-1` evaluates to +7 days) Coverage added through boundary functions, as requested (`timePlaceHolderWithBoundaryOffsetAfterTimezoneLiteral`, `timePlaceHolderWithUnaryMinusInBoundaryOffset`, `timePlaceHolderWithBoundaryArithmeticFailure`): - timezone + offset combinations: `+08:00-1`, `+08:00+1`, compact `+0800-1` (the `0800` prefix is recognized as a timezone literal rather than the start of the arithmetic operand), and a quoted zone-name suffix `+08:00' (CST)'-1` - unary and parenthesized offsets through calcFormatOffset: `month_first_day(yyyy-MM-dd-7*-1)`, `month_first_day(yyyyMMdd+7*-1)`, `week_last_day(yyyyMMdd+7*(-1))` - arithmetic failure propagation in both modes: ignore-invalid preserves `$[month_first_day(yyyy-MM-dd+1/0)]`, strict rejects All 140 tests in `dolphinscheduler-task-api` pass and spotless is clean. -- 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]
