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/03/20 11:08:26 UTC

[GitHub] [arrow-datafusion] alamb opened a new issue, #5652: Support automatic string --> interval casting

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

   **Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
   I would like to write a query like
   ```sql
   ❯ select * from foo where x < now() - '1 day';
   ```
   
   Here is what happens today
   
   ```sql
   ❯ create table foo(x timestamp) as select '2023-03-01'::timestamp;
   0 rows in set. Query took 0.002 seconds.
   ❯ select * from foo;
   +---------------------+
   | x                   |
   +---------------------+
   | 2023-03-01T00:00:00 |
   +---------------------+
   1 row in set. Query took 0.001 seconds.
   ❯ select * from foo where x < now() - '1 day';
   Internal error: The type of Timestamp(Nanosecond, Some("+00:00")) Minus Utf8 of binary physical should be same. This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker
   ```
   
   **Describe the solution you'd like**
   I would like the query to work (by adding coercion rules to automatically coerce string --> interval if appropriate)
   
   **Describe alternatives you've considered**
   N/A
   
   **Additional context**
   I think we will need to fix https://github.com/apache/arrow-datafusion/issues/5650 and  https://github.com/apache/arrow-datafusion/issues/5651
   


-- 
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] Dandandan commented on issue #5652: Support automatic string --> interval casting

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

   You can't do this in PostgreSQL too, without adding `INTERVAL`, like this:
   
   `select now() - interval '1 day';`
   
   


-- 
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 #5652: Support automatic string --> interval casting

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #5652: Support automatic string --> interval casting
URL: https://github.com/apache/arrow-datafusion/issues/5652


-- 
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] Dandandan commented on issue #5652: Support automatic string --> interval casting

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

   This does work in postgresql though and not in datafusion:
   
   ```
   select '1 day' - interval '1 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] Dandandan commented on issue #5652: Support automatic string --> interval casting

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

   The same works today in datafusion:
   
   ```
   ❯ select now() - interval '1 day';
   +------------------------------------------------------+
   | now() - IntervalMonthDayNano("18446744073709551616") |
   +------------------------------------------------------+
   | 2023-06-07T13:58:37.973698Z                          |
   +------------------------------------------------------+
   1 row in set. Query took 0.003 seconds.
   ```


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