[ 
https://issues.apache.org/jira/browse/DRILL-4525?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16478921#comment-16478921
 ] 

ASF GitHub Bot commented on DRILL-4525:
---------------------------------------

vvysotskyi commented on a change in pull request #1268: DRILL-4525: Allow 
SqlBetweenOperator to accept LOWER_OPERAND and UPPER_OPERAND with different 
types
URL: https://github.com/apache/drill/pull/1268#discussion_r188923002
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/DrillOperatorTable.java
 ##########
 @@ -158,26 +159,39 @@ private void 
populateFromWithoutTypeInference(SqlIdentifier opName, SqlFunctionC
 
   // Get the list of SqlOperator's with the given name.
   public List<SqlOperator> getSqlOperator(String name) {
-    if(isInferenceEnabled()) {
+    if (isInferenceEnabled()) {
       return drillOperatorsWithInferenceMap.get(name.toLowerCase());
     } else {
       return drillOperatorsWithoutInferenceMap.get(name.toLowerCase());
     }
   }
 
   private void populateWrappedCalciteOperators() {
-    for(SqlOperator calciteOperator : inner.getOperatorList()) {
+    for (SqlOperator calciteOperator : inner.getOperatorList()) {
       final SqlOperator wrapper;
-      if(calciteOperator instanceof SqlAggFunction) {
+      if (calciteOperator instanceof SqlAggFunction) {
         wrapper = new DrillCalciteSqlAggFunctionWrapper((SqlAggFunction) 
calciteOperator,
             getFunctionListWithInference(calciteOperator.getName()));
-      } else if(calciteOperator instanceof SqlFunction) {
+      } else if (calciteOperator instanceof SqlFunction) {
         wrapper = new DrillCalciteSqlFunctionWrapper((SqlFunction) 
calciteOperator,
             getFunctionListWithInference(calciteOperator.getName()));
+      } else if (calciteOperator instanceof SqlBetweenOperator) {
+        // During the procedure of converting to RexNode,
+        // StandardConvertletTable.convertBetween expects the SqlOperator to 
be a subclass of SqlBetweenOperator
+        final SqlBetweenOperator sqlBetweenOperator = (SqlBetweenOperator) 
calciteOperator;
+        wrapper = new 
DrillCalciteSqlBetweenOperatorWrapper(sqlBetweenOperator);
       } else {
-        final String drillOpName = 
FunctionCallFactory.replaceOpWithFuncName(calciteOperator.getName());
+        final String drillOpName;
+        // For UNARY_MINUS (-) or UNARY_PLUS (+), we do not rename them as 
function_add or function_subtract.
 
 Review comment:
   Could you please explain a little bit more the reason for these changes if 
they are still valid and please add a unit test for this.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Query with BETWEEN clause on Date and Timestamp values fails with Validation 
> Error
> ----------------------------------------------------------------------------------
>
>                 Key: DRILL-4525
>                 URL: https://issues.apache.org/jira/browse/DRILL-4525
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Query Planning &amp; Optimization
>            Reporter: Abhishek Girish
>            Assignee: Bohdan Kazydub
>            Priority: Critical
>             Fix For: 1.14.0
>
>
> Query: (simplified variant of TPC-DS Query37)
> {code}
> SELECT
>        *
> FROM   
>        date_dim
> WHERE   
>        d_date BETWEEN Cast('1999-03-06' AS DATE) AND      (
>                   Cast('1999-03-06' AS DATE) + INTERVAL '60' day)
> LIMIT 10;
> {code}
> Error:
> {code}
> Error: VALIDATION ERROR: From line 6, column 8 to line 7, column 64: Cannot 
> apply 'BETWEEN ASYMMETRIC' to arguments of type '<ANY> BETWEEN ASYMMETRIC 
> <DATE> AND <TIMESTAMP(0)>'. Supported form(s): '<COMPARABLE_TYPE> BETWEEN 
> <COMPARABLE_TYPE> AND <COMPARABLE_TYPE>'
> SQL Query null
> [Error Id: 223fb37c-f561-4a37-9283-871dc6f4d6d0 on abhi2:31010] 
> (state=,code=0)
> {code}
> This is a regression from 1.6.0. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to