dzamo commented on pull request #2268:
URL: https://github.com/apache/drill/pull/2268#issuecomment-875319179


   The current AGE function is completely half-baked, look at the transcript 
below.  A total replacement is the surely the best route and further attempts 
at calendar arithemetic using DateUtilities are probably inadvisable.  Can 
`java.time` not provide what Joda is being used for in this first version of a 
fix?
   
   ```
   apache drill> select age('2021-01-01', '2021-01-01');
   +---------------------------------+
   |             EXPR$0              |
   +---------------------------------+
   | 0 years 0 months 0 days 0:00:00 |
   +---------------------------------+
   1 row selected (0.179 seconds)
   apache drill> select age('2021-02-01', '2021-01-01');
   +-------------------------------+
   |            EXPR$0             |
   +-------------------------------+
   | 0 years 1 month 1 day 0:00:00 |
   +-------------------------------+
   1 row selected (0.159 seconds)
   apache drill> select age('2021-03-01', '2021-01-01');
   +---------------------------------+
   |             EXPR$0              |
   +---------------------------------+
   | 0 years 1 month 29 days 0:00:00 |
   +---------------------------------+
   1 row selected (0.158 seconds)
   apache drill> select age('2022-01-01', '2021-01-01');
   +--------------------------------+
   |             EXPR$0             |
   +--------------------------------+
   | 1 year 0 months 5 days 0:00:00 |
   +--------------------------------+
   1 row selected (0.12 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to