Ben Hollis created SPARK-58300:
----------------------------------

             Summary: Add from_protobuf option to keep Timestamp/Duration as 
struct<seconds, nanos>
                 Key: SPARK-58300
                 URL: https://issues.apache.org/jira/browse/SPARK-58300
             Project: Spark
          Issue Type: Improvement
          Components: Protobuf
    Affects Versions: 4.3.0
            Reporter: Ben Hollis


`from_protobuf` always maps `google.protobuf.Timestamp` -> `TimestampType` and 
`google.protobuf.Duration` -> `DayTimeIntervalType`. This is Spark's 
well-known-type conversion and there is currently no way to turn it off.

This adds a `from_protobuf` reader option 
`convert.timestamp.duration.to.native` (default `true`, preserving today's 
behavior). When set to `false`, both well-known types fall through to the 
generic message path and deserialize as their raw proto shape `struct<seconds: 
bigint, nanos: int>`.

Motivation: a consumer whose downstream schema was defined against the 
\{seconds, nanos} struct representation (e.g. a table populated by a different 
decode path) and must stay stable, or that needs the exact seconds/nanos rather 
than a microsecond-truncated interval/timestamp.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to