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

   ### What changes were proposed in this pull request?
   
   Add the ANSI `LOCALTIME` datetime value function as an alias for 
`current_time`, returning the current local time as `TimeType` with optional 
precision.
   
   ### Why are the changes needed?
   
   ANSI SQL defines `LOCALTIME` (TIME WITHOUT TIME ZONE) alongside 
`CURRENT_TIME`. Spark has `localtimestamp` but not `localtime`. Since Spark's 
`TIME` is always WITHOUT TIME ZONE, `LOCALTIME` is the standard-named 
counterpart.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. `SELECT LOCALTIME`, `SELECT LOCALTIME()`, and `SELECT localtime(3)` now 
return the current time at the requested precision.
   
   ### How was this patch tested?
   
   - Added parser test: `LOCALTIME` resolves to CurrentTime() in ANSI mode, 
UnresolvedAttribute in non-ANSI mode (ExpressionParserSuite)
   - Added end-to-end test: `localtime()` returns `TimeType(6)`, `localtime(3)` 
returns `TimeType(3)`, `localtime() equals current_time()` 
   - All existing tests pass (ExpressionParserSuite: 50/50, 
TimeExpressionsSuite: 20/20)
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Co-Authored using Claude Opus 4.6


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