maropu edited a comment on issue #25189: [SPARK-28435][SQL] Support accepting 
the interval keyword in the schema string
URL: https://github.com/apache/spark/pull/25189#issuecomment-519305483
 
 
   Yea, pg can explicitly cast a text to interval;
   ```
   postgres=# \d t
                     Table "public.t"
      Column    | Type | Collation | Nullable | Default 
   -------------+------+-----------+----------+---------
    intervalstr | text |           |          | 
   
   postgres=# select * from t;
    intervalstr 
   -------------
    1 hour
   (1 row)
   
   postgres=# select cast(intervalstr as interval) from t;
    intervalstr 
   -------------
    01:00:00
   (1 row)
   
   postgres=# create temporary view v as select cast(intervalstr as interval) 
from t;
   postgres=# \d v
                      View "pg_temp_3.v"
      Column    |   Type   | Collation | Nullable | Default 
   -------------+----------+-----------+----------+---------
    intervalstr | interval |           |          | 
   
   // literal case
   postgres=# select cast('1 hour' as interval);
    interval 
   ----------
    01:00:00
   (1 row)
   ```

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to