[GitHub] [spark] AngersZhuuuu commented on pull request #32001: [SPARK-34902][SQL] Support cast between LongType & DayTimeIntervalType and IntegerType & YearMonthIntervalType

2021-04-20 Thread GitBox


AngersZh commented on pull request #32001:
URL: https://github.com/apache/spark/pull/32001#issuecomment-823356024


   > @AngersZh thanks for looking into it! Shall we close this PR then?
   
   Sure, close it


-- 
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:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] AngersZhuuuu commented on pull request #32001: [SPARK-34902][SQL] Support cast between LongType & DayTimeIntervalType and IntegerType & YearMonthIntervalType

2021-04-20 Thread GitBox


AngersZh commented on pull request #32001:
URL: https://github.com/apache/spark/pull/32001#issuecomment-823172232


   PG not support similar `cast`
   
![image](https://user-images.githubusercontent.com/46485123/115382928-cfd14000-a207-11eb-88e2-e74cdd7ee2f0.png)
   
   
![image](https://user-images.githubusercontent.com/46485123/115382989-e081b600-a207-11eb-82b5-27fdfec9b6f4.png)
   
![image](https://user-images.githubusercontent.com/46485123/115383005-e4add380-a207-11eb-9655-3dbc98b86a5d.png)
   
![image](https://user-images.githubusercontent.com/46485123/115383014-e8415a80-a207-11eb-9cca-3695d5581a4a.png)
   
   
![image](https://user-images.githubusercontent.com/46485123/115382877-c1832400-a207-11eb-85d8-20192652b42f.png)
   


-- 
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:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] AngersZhuuuu commented on pull request #32001: [SPARK-34902][SQL] Support cast between LongType & DayTimeIntervalType and IntegerType & YearMonthIntervalType

2021-03-31 Thread GitBox


AngersZh commented on pull request #32001:
URL: https://github.com/apache/spark/pull/32001#issuecomment-810814418


   > As @cloud-fan said we have special functions that convert numbers to 
timestamps. I quickly look at Oracle, it has similar function for intervals. 
For example, 
[NUMTODSINTERVAL](https://docs.oracle.com/cd/E11882_01/server.112/e41084/functions117.htm#SQLRF00682)
 converts a `NUM` to a `DAY TO SECOND INTERVAL`:
   > 
   > ```
   > NUMTODSINTERVAL(100, 'day')
   > ```
   > 
   > @AngersZh Could you look at other DMBS, and see how they cast 
intervals from/to numbers.
   
   Sure.


-- 
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:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] AngersZhuuuu commented on pull request #32001: [SPARK-34902][SQL] Support cast between LongType & DayTimeIntervalType and IntegerType & YearMonthIntervalType

2021-03-30 Thread GitBox


AngersZh commented on pull request #32001:
URL: https://github.com/apache/spark/pull/32001#issuecomment-810723338


   > @AngersZh Any thoughts about use cases? @cloud-fan I could imagine the 
use cases when we need to transfer/save/load intervals to external systems that 
don't support any interval types natively. In that case, we can convert our 
intervals to int/long upload there, and maybe perform some arithmetic ops in 
the remote systems. If we look at the alternatives proposed by you:
   
   These two types have a standard value, such as microsecond. When there are 
standard values, this conversion could be safe.  Such as DayTimeIntervalType, 
for this type, when store in InternalRow, the value is microsecond,  then the 
conversion is safety. 
   
   Compared with other string or `make_interval`  function conversions, numeric 
conversion is more direct and easy to use when integrate with other system.
   
   We need to describe these content in detail in the document, such as the 
meaning of the stored value type, so that users can use it correctly when use 
`cast`.


-- 
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:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] AngersZhuuuu commented on pull request #32001: [SPARK-34902][SQL] Support cast between LongType & DayTimeIntervalType and IntegerType & YearMonthIntervalType

2021-03-29 Thread GitBox


AngersZh commented on pull request #32001:
URL: https://github.com/apache/spark/pull/32001#issuecomment-809928048


   FYI @MaxGekk 


-- 
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:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org