You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/06/19 14:22:02 UTC

[GitHub] [arrow-datafusion] alamb opened a new issue, #6720: Incorrect results for negative intervals

alamb opened a new issue, #6720:
URL: https://github.com/apache/arrow-datafusion/issues/6720

                 To me this doesn't look right. The previous test seems correct. When putting a negation in front of interval I believe it should negate the entire interval statement.
   
   `interval '5' - '1' - '2' year` is one interval statement.
   
   I think the statement
   
   ```
   select -interval '5' - '1' - '2' year;
   ```
   
   Should be interpreted as:
   
   ```
   select - (interval '5' - '1' - '2' year);
   ```
   
   Rather than
   
   ```
   select (- interval '5') - '1' - '2' year;
   ```
   
   If the user wants to negate only `5`, they should write it as follows (below are all equivalents):
   
   ```
   select interval '-5' - '1' - '2' year;
   select interval - '5' - '1' - '2' year;
   select - interval '5' year - interval '1' year - interval '2' year;
   ```
   
   _Originally posted by @aprimadi in https://github.com/apache/arrow-datafusion/pull/6698#discussion_r1232607304_
               


-- 
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: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on issue #6720: Incorrect results for negative intervals

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #6720:
URL: https://github.com/apache/arrow-datafusion/issues/6720#issuecomment-1597289410

   However, note the current datafusion behavior is consistent with postgres as explained by @waitingkuo  in https://github.com/apache/arrow-datafusion/pull/6698#pullrequestreview-1485187142:
   
   -------
   
   
   looks good to me, thanks.
   
   in postgrseql
   ```bash
   select -interval '5' - '1' - '2';
   ```
   is intepreted as 
   ```bash
   select (-interval '5') - '1' - '2';
   ```
   ```bash
   willy=# select -interval '5' - '1' - '2';
    ?column?  
   -----------
    -00:00:08
   (1 row)
   ```
   note that `select -interval '5' - '1' - '2' hour` doesn't work in postgresql
   ```bash
   willy=# select -interval '5' - '1' - '2' hour;
   ERROR:  syntax error at or near "hour"
   LINE 1: select -interval '5' - '1' - '2' hour;
   ```
   
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb closed issue #6720: Incorrect results for negative intervals

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #6720: Incorrect results for negative intervals
URL: https://github.com/apache/arrow-datafusion/issues/6720


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on issue #6720: Incorrect results for negative intervals

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #6720:
URL: https://github.com/apache/arrow-datafusion/issues/6720#issuecomment-1724680826

   I don't think this ticket is tracking anything actionable now, so closing


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org