Jackie-Jiang opened a new pull request, #18940:
URL: https://github.com/apache/pinot/pull/18940

   ## Summary
   
   `PinotDataType.STRING` and `JSON` `toInt`/`toLong` parsed strictly via 
`Integer.parseInt` / `Long.parseLong`, throwing `NumberFormatException` on 
decimal or scientific-notation numeric strings (e.g. `"416359.0"`, 
`"1.4988924E12"`).
   
   This regressed `dateTimeConvert` after #18814, which widened the time-value 
parameter to `Object` and routes `EPOCH` / `TIMESTAMP` input through 
`PinotDataType.LONG.convert(value, STRING)`. Numeric epoch values that arrive 
as decimal/scientific strings previously worked — the old `String` path parsed 
them via `BigDecimal` — but started throwing.
   
   ### Fix
   - `STRING`/`JSON` `toInt`/`toLong` fall back to `BigDecimal` parsing when 
the strict parse fails, truncating the fractional part toward zero. This 
matches the `BIG_DECIMAL` type's `intValue()`/`longValue()` behavior (the 
natural analog for a decimal string) and preserves the strict fast path for 
plain integer strings.
   - `DateTimeFormatSpec.fromFormatToMillis(String)` now reuses 
`PinotDataType.STRING.toLong` instead of `new BigDecimal(...).longValue()`. 
Same behavior, but it takes the `Long.parseLong` fast path for plain integer 
epoch values (the common case) and only falls back to `BigDecimal` for 
fractional/scientific forms.
   
   ### Tests
   - `PinotDataTypeTest#testNumericStringToIntegral` — `STRING`/`JSON` 
`toInt`/`toLong` on plain, decimal, scientific, and whitespace-padded strings; 
non-numeric strings still throw; plus the `LONG.convert(numericString, STRING)` 
path.
   - `DateTimeFormatSpecTest` — decimal/scientific `EPOCH` entries through 
`fromFormatToMillis(String)`.
   - `DateTimeFunctionsTest#testDateTimeConvertNumericStringEpoch` — end-to-end 
`dateTimeConvert` regression with decimal/scientific epoch string input.
   


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