AngersZhuuuu opened a new pull request #32001:
URL: https://github.com/apache/spark/pull/32001


   ### What changes were proposed in this pull request?
   Before this pr, if we want to cast LongType to DayTimeIntervalType will got 
error
   ```
   [info]   org.apache.spark.sql.AnalysisException: cannot resolve 'CAST(a AS 
DAY-TIME INTERVAL)' due to data type mismatch: cannot cast bigint to day-time 
interval;
   [info] 'Project [cast(a#4L as day-time interval) AS b#6]
   [info] +- Project [value#1L AS a#4L]
   [info]    +- LocalRelation [value#1L]
   ```
   
   Since DayTimeIntervalType store value as Long and  YearMonthIntervalType 
store value as Int, in this pr we support cast between them.
   
   ### Why are the changes needed?
   User can  cast between LongType & DayTimeIntervalType and IntegerType & 
YearMonthIntervalType
   
   ```
   SELECT cast(123L to day-time interval)
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   Support cast between LongType & DayTimeIntervalType and IntegerType & 
YearMonthIntervalType
   
   
   ### How was this patch tested?
   added UT
   


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

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