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/05/03 14:16:51 UTC

[GitHub] [arrow-datafusion] alamb opened a new issue, #6205: select `interval '1 month'` + date/timestamp doesn't work

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

   ### Describe the bug
   
   I can add a date and an interval using the `interval` syntax
   ```
   ❯ select '2012-01-01'::date + interval '1 month';
   +----------------------------------------------------------------------------+
   | Utf8("2012-01-01") + IntervalMonthDayNano("79228162514264337593543950336") |
   +----------------------------------------------------------------------------+
   | 2012-02-01                                                                 |
   +----------------------------------------------------------------------------+
   ```
   
   I can add a interval and date using the explicit `::interval` syntax:
   
   ```
   ❯ select '1 month'::interval + '2012-01-01'::date;
   +--------------------------------------+
   | Utf8("1 month") + Utf8("2012-01-01") |
   +--------------------------------------+
   | 2012-02-01                           |
   +--------------------------------------+
   ```
   
   However, I can not add a `interval` and `date` using `interval` sytnax 🤯 
   
   ```
   ❯ select interval '1 month' + '2012-01-01'::date;
   This feature is not implemented: Unsupported interval argument. Expected string literal, got: BinaryOp { left: Value(SingleQuotedString("1 month")), op: Plus, right: Cast { expr: Value(SingleQuotedString("2012-01-01")), data_type: Date } }
   ```
   
   ### To Reproduce
   
   ```
   ❯ select interval '1 month' + '2012-01-01'::date;
   ```
   
   ### Expected behavior
   
   ```
   +--------------------------------------+
   | Utf8("1 month") + Utf8("2012-01-01") |
   +--------------------------------------+
   | 2012-02-01                           |
   +--------------------------------------+
   ```
   
   ### Additional context
   
   This looks like potentially a sqlparser-rs bug (or something about how datafusion handles the resulting AST)
   
   Originally filed by @jackwener  as  https://github.com/apache/arrow-datafusion/issues/6180


-- 
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 closed issue #6205: select `interval '1 month'` + date/timestamp doesn't work

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #6205: select `interval '1 month'` + date/timestamp doesn't work
URL: https://github.com/apache/arrow-datafusion/issues/6205


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