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

   ### What changes were proposed in this pull request?
   
   This PR completes 
[SPARK-56969](https://issues.apache.org/jira/browse/SPARK-56969) on top of the 
parser gating added in 
[SPARK-56965](https://issues.apache.org/jira/browse/SPARK-56965) / 
[#56041](https://github.com/apache/spark/pull/56041).
   
   - Extend `TypeUtils.failUnsupportedDataType` to recursively reject 
`TimestampNTZNanosType` and `TimestampLTZNanosType` when 
`spark.sql.timestampNanosTypes.enabled` is off.
   - Add `UNSUPPORTED_TIMESTAMP_NANOS_TYPE` with a message naming the conf key.
   - Expand the SQLConf doc for `spark.sql.timestampNanosTypes.enabled` and 
align its default with `Utils.isTesting` (mirroring 
`spark.sql.timeType.enabled`).
   - Add a short enablement note for preview nanos timestamp types in 
`docs/sql-ref-datatypes.md`.
   
   Part of SPIP 
[SPARK-56822](https://issues.apache.org/jira/browse/SPARK-56822).
   
   ### Why are the changes needed?
   
   Parser and JSON entry points already gate parameterized nanos timestamp 
types behind `spark.sql.timestampNanosTypes.enabled`, but analyzed 
schemas/plans could still surface these types through other paths (for example 
`CREATE TABLE`, connectors, or programmatic schemas) before downstream 
execution support is ready.
   
   Analysis-time gating closes that gap and keeps behavior consistent with the 
existing preview flag.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes.
   
   - When `spark.sql.timestampNanosTypes.enabled` is off, analyzed 
schemas/plans containing `TIMESTAMP_NTZ(p)` / `TIMESTAMP_LTZ(p)` with `p` in 
`[7, 9]` now fail with `UNSUPPORTED_TIMESTAMP_NANOS_TYPE`.
   - The conf default is now `Utils.isTesting` instead of always `false`, so 
tests enable the preview by default while production remains off.
   - `docs/sql-ref-datatypes.md` documents how to enable the preview feature.
   
   Unparameterized `TIMESTAMP`, `TIMESTAMP_NTZ`, and `TIMESTAMP_LTZ` behavior 
is unchanged.
   
   Example:
   
   ```sql
   SET spark.sql.timestampNanosTypes.enabled=false;
   CREATE TABLE t (c TIMESTAMP_NTZ(9));
   -- UNSUPPORTED_TIMESTAMP_NANOS_TYPE: ... Set 
"spark.sql.timestampNanosTypes.enabled" to "true" ...
   ```
   
   ### How was this patch tested?
   Added/updated unit tests:
   
   - TypeUtilsSuite: default conf behavior, analysis gating on/off, microsecond 
types unaffected
   - DataTypeParserSuite: explicitly disable conf when testing parser rejection
   - DataTypeSuite: explicitly disable conf when testing JSON rejection
   
   Existing nanos parser/JSON tests continue to pass with the conf enabled.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   Generated-by: Cursor Auto


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