david-mollitor-db commented on PR #58796:
URL: https://github.com/apache/spark/pull/58796#issuecomment-5680629255

   Thanks for the careful review, @HyukjinKwon! You're right: the only path 
where the fraction can exceed 9 digits is the legacy `parseDayTimeLegacy` (its 
`dayTimePatternLegacy` captures the fraction with an unbounded `\d+`), 
reachable with `spark.sql.legacy.fromDayTimeString.enabled=true` -- and there 
the new code hit `nanosMultiplier(-1)`.
   
   I applied your suggested guard so a fraction of length `>= maxNanosLen` 
returns `raw` directly, which reproduces the old `alignedStr = nanos` behavior 
exactly (for `len == 9` it equals `raw * nanosMultiplier(0)`). I also added a 
regression test to the "from day-time string - legacy" case covering a 10+ 
digit leading-zero fraction (e.g. `0 0:0:0.0000000001`), which threw an 
`ArrayIndexOutOfBoundsException` before the fix and now parses to 0 micros as 
before.
   
   Rebased on latest master and force-pushed. Mind taking another look?


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