MaxGekk commented on PR #56778:
URL: https://github.com/apache/spark/pull/56778#issuecomment-4800989476

   cc @peter-toth @HyukjinKwon @dongjoon-hyun @dengziming -- you worked on 
#51464 ([SPARK-52770] Support `TIME` type in connect proto), which added the 
original `TIME` <-> Arrow mapping in `ArrowUtils`.
   
   That mapping sends every `TimeType(p)` to `ArrowType.Time(NANOSECOND, 64)` 
and reads it back as a fixed `TimeType(6)`, because Arrow's `Time` logical type 
has no fractional-second-precision field. So the declared precision is lost on 
any Arrow round-trip: `TIME(0)`, `TIME(3)`, `TIME(9)`, ... all come back as 
`TIME(6)`, silently widening/narrowing the type label over Connect 
schema/results, `createDataFrame` from Arrow, `mapInArrow`, etc. (stored values 
are unaffected -- they are already nanosecond-resolution).
   
   This PR fixes the type-fidelity gap by carrying `p` in the Arrow field 
metadata (`SPARK::time::precision`), the same channel the nanosecond timestamp 
types use (SPARK-57159), with a fallback to the canonical `TIME(6)` for foreign 
Arrow data. Since you're familiar with the original code, would you mind taking 
a look? Thanks!


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