stevomitric opened a new pull request, #56041:
URL: https://github.com/apache/spark/pull/56041

   ### What changes were proposed in this pull request?
   Adds SQL parser support for parameterized nanosecond-precision timestamp 
types introduced in SPARK-56876. The parser now accepts:
     - TIMESTAMP_NTZ(p) -> TimestampNTZNanosType(p)
     - TIMESTAMP_LTZ(p) -> TimestampLTZNanosType(p)
     - TIMESTAMP(p) WITHOUT TIME ZONE (alias for TIMESTAMP_NTZ(p))
     - TIMESTAMP(p) WITH LOCAL TIME ZONE (alias for TIMESTAMP_LTZ(p))
     - TIMESTAMP(p) (resolves via spark.sql.timestampType session default)
   
   with `p` from `[7, 9]`. Out-of-range precision throws 
`INVALID_TIMESTAMP_PRECISION`; negative precision is rejected by the grammar as 
`PARSE_SYNTAX_ERROR`.
   
   The new syntax is gated behind a new internal preview flag 
`spark.sql.timestampNanosTypes.enabled` (default false).
   
   Unparameterized TIMESTAMP, TIMESTAMP_NTZ, TIMESTAMP_LTZ, and the 
WITH/WITHOUT TIME ZONE variants continue to return the existing microsecond 
types - no behavior change.
   
   Part of SPIP SPARK-56822 (https://issues.apache.org/jira/browse/SPARK-56822).
   
   ### Why are the changes needed?
   SPARK-56876 added TimestampNTZNanosType / TimestampLTZNanosType to the type 
system but explicitly left out SQL/DDL integration - users cannot declare these 
types in CREATE TABLE, CAST, or Column.cast(String) today. This PR is the 
parser sub-task of the SPIP and wires those spellings through 
DataTypeAstBuilder, behind a preview flag so the surface is opt-in until the 
cast/runtime sub-tasks land.
   
   
   ### Does this PR introduce _any_ user-facing change?
   Yes made the parser changes to allow timestamps with precision.
   
   
   ### How was this patch tested?
   Extended DataTypeParserSuite
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   Yes
   


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