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

   **Describe the bug**
   A clear and concise description of what the bug is.
   
   the output of `INTERVAL XXX` is inconsistent
   
   **To Reproduce**
   Steps to reproduce the behavior:
   
   while we only have year or month, `it outputs IntervalYearMonth`
   ```bash
   ❯ select interval '1 year';
   +------------------------------------------------+
   | IntervalYearMonth("12")                        |
   +------------------------------------------------+
   | 1 years 0 mons 0 days 0 hours 0 mins 0.00 secs |
   +------------------------------------------------+
   1 row in set. Query took 0.001 seconds.
   ❯ select interval '1 year 1 month';
   +------------------------------------------------+
   | IntervalYearMonth("13")                        |
   +------------------------------------------------+
   | 1 years 1 mons 0 days 0 hours 0 mins 0.00 secs |
   +------------------------------------------------+
   ```
   
   while we have (year or month) and any other unit, it outputs 
`IntervalMonthDayNano`
   ```bash
   +--------------------------------------------------------+
   | IntervalMonthDayNano("950737950189618795196236955648") |
   +--------------------------------------------------------+
   | 0 years 12 mons 1 days 0 hours 0 mins 0.00 secs        |
   +--------------------------------------------------------+
   1 row in set. Query took 0.001 seconds.
   ❯ select interval '1 year 1 second';
   +--------------------------------------------------------+
   | IntervalMonthDayNano("950737950171172051123527404032") |
   +--------------------------------------------------------+
   | 0 years 12 mons 0 days 0 hours 0 mins 1.00 secs        |
   +--------------------------------------------------------+
   1 row in set. Query took 0.001 seconds.
   ```
   
   Otherwise, it outputs `IntervalDaytime`
   ```bash
   ❯ select interval '1 second';
   +------------------------------------------------+
   | IntervalDayTime("1000")                        |
   +------------------------------------------------+
   | 0 years 0 mons 0 days 0 hours 0 mins 1.00 secs |
   +------------------------------------------------+
   1 row in set. Query took 0.001 seconds.
   ❯ select interval '1 day 1 second';
   +------------------------------------------------+
   | IntervalDayTime("4294968296")                  |
   +------------------------------------------------+
   | 0 years 0 mons 1 days 0 hours 0 mins 1.00 secs |
   +------------------------------------------------+
   1 row in set. Query took 0.001 seconds.
   ```
   
   **Expected behavior**
   A clear and concise description of what you expected to happen.
   
   they should be consistent, as our current Timestamp is in nanosecond, i 
suggest using `IntervalMonthDayNano`. We could consider add functions to output 
specific data type(i.e. `to_interval_monthdaynano()`, `to_interval_daytime()`, 
`interval_yearmonth()` . But i think they might need different arithmetics
   
   **Additional context**
   Add any other context about the problem here.
   


-- 
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-unsubscr...@arrow.apache.org.apache.org

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

Reply via email to