pan3793 opened a new pull request, #58734:
URL: https://github.com/apache/spark/pull/58734
### What changes were proposed in this pull request?
Make LTZ type rendering follow spark.sql.timestampType: when the session
default is
TIMESTAMP_NTZ, SHOW CREATE TABLE / schema DDL and LTZ literals spell
TIMESTAMP_LTZ
explicitly, so the emitted text re-parses to the same type. Nested fields
are covered.
No new configuration.
### Why are the changes needed?
Under spark.sql.timestampType=TIMESTAMP_NTZ the emitted DDL is not
round-trippable:
SET spark.sql.timestampType=TIMESTAMP_NTZ;
CREATE TABLE t (ltz TIMESTAMP_LTZ) USING parquet;
SHOW CREATE TABLE t;
-- before: ltz TIMESTAMP -- reparse yields TIMESTAMP_NTZ
-- after: ltz TIMESTAMP_LTZ
LTZ literals have the same problem in plan and column text.
### Does this PR introduce _any_ user-facing change?
Yes, only when spark.sql.timestampType=TIMESTAMP_NTZ: LTZ columns show as
TIMESTAMP_LTZ
in SHOW CREATE TABLE / schema DDL, and LTZ literals render as TIMESTAMP_LTZ
'...'. The
default (TIMESTAMP_LTZ) output is unchanged.
### How was this patch tested?
Added unit tests for both defaults and NTZ-default golden variants (goldens
regenerated
with SPARK_GENERATE_GOLDEN_FILES=1 and reviewed). Verified with the catalyst
literal and
type suites and the sql timestamp and SHOW CREATE TABLE suites.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Codex
--
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]