Github user jinfengni commented on the pull request: https://github.com/apache/drill/pull/439#issuecomment-200883747 Looks like the root cause of the problem is Calcite does not allow the comparison of Date and Timestamp. {code} select CAST('1990-01-01' AS DATE) < CAST('2001-01-01' AS TIMESTAMP) FROM (VALUES(1, 2)) AS T(A,B); Mar 24, 2016 8:15:53 AM org.apache.calcite.sql.validate.SqlValidatorException <init> SEVERE: org.apache.calcite.sql.validate.SqlValidatorException: Cannot apply '<' to arguments of type '<DATE> < <TIMESTAMP(0)>'. Supported form(s): '<COMPARABLE_TYPE> < <COMPARABLE_TYPE>' {code} Postgres, on the country, supports date vs timestamp compare, through implicit cast. {code} select CAST('1990-01-01' AS DATE) < CAST('2001-01-01' AS TIMESTAMP) FROM (VALUES(1, 2)) AS T(A,B); ?column? ---------- t (1 row) {code} I looked through SQL standard, and could not find the rules for the implicit cast, which means different system could choose it's own interpretation. (In other words, it's hard to argue what Calcite is doing is not right) What Sean is trying to do with his proposal is to replace Calcite's between operator with Drill's between operator, so that the checkOperand will use Drill's rule.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---