yaooqinn commented on issue #26418: [SPARK-29783][SQL] Support SQL 
Standard/ISO_8601 output style for interval type
URL: https://github.com/apache/spark/pull/26418#issuecomment-552900624
 
 
   
   ```
   postgres=# select interval '-2 days -23 hours' = interval '-2 days 23 hours';
    ?column?
   ----------
    t
   (1 row)
   
   postgres=# select interval '-1 year 1 day 1 minute';
        interval
   ------------------
    -1-0 -1 -0:01:00
   (1 row)
   ```
   
   What Postgres does here is that when `sql_standard` is specified and there 
is a single leading '-', then the whole part will be negative. So this time `-2 
day 23 hour` sql_standardly equals to`-2 day -23 hour`.
   
   If we follow what pg does, we need to change the multi-units interval 
parsing logic to SQL standard. otherwise, we do that logic in the old way and 
just output SQL standard style format with explicit '+' and '-' from each part. 
   The related conf in Postgres is called `IntervalStyle`, but in Spark, we 
call it intervalOutputStyle, so we may take the second choice. @cloud-fan 
   

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