[jira] [Commented] (DRILL-4642) Let RexBuilder.ensureType() mechanism take place during Rex conversion.

2022-06-16 Thread ASF GitHub Bot (Jira)


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

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

hsuanyi closed pull request #489: DRILL-4642: Remove customized 
RexBuilder.ensureType()
URL: https://github.com/apache/drill/pull/489




> Let RexBuilder.ensureType() mechanism take place during Rex conversion.
> ---
>
> Key: DRILL-4642
> URL: https://issues.apache.org/jira/browse/DRILL-4642
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Query Planning  Optimization
>Reporter: Sean Hsuan-Yi Chu
>Assignee: Jinfeng Ni
>Priority: Major
> Fix For: Future
>
>
> In DRILL-4372, the logic of ensuring same type is removed since, in some case 
> such as below, undesirable cast function will be added and cause failure.
> {code}
> SELECT * 
> FROM T 
> WHERE (cast(col1 as timestamp)  - to_timestamp(col2,'-MM-dd HH:mm:ss') < 
> interval 'X XX:XX:XX' day to second)
> {code}
> The fundamental reason for this behavior roots in Drill-Calcite [1], where 
> SqlNode WHERE is expanded to a new object but is not passed into validation 
> step.
> [1] 
> https://github.com/mapr/incubator-calcite/blob/DrillCalcite1.4.0-mapr-1.4.0/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3362



--
This message was sent by Atlassian Jira
(v8.20.7#820007)


[jira] [Commented] (DRILL-4642) Let RexBuilder.ensureType() mechanism take place during Rex conversion.

2018-06-08 Thread ASF GitHub Bot (JIRA)


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

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

ilooner commented on issue #489: DRILL-4642: Remove customized 
RexBuilder.ensureType()
URL: https://github.com/apache/drill/pull/489#issuecomment-395851550
 
 
   @hsuanyi Drill is currently on calcite version 1.16.0-drill-r3 is this 
change still applicable? If so could you rebase?


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


> Let RexBuilder.ensureType() mechanism take place during Rex conversion.
> ---
>
> Key: DRILL-4642
> URL: https://issues.apache.org/jira/browse/DRILL-4642
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Query Planning  Optimization
>Reporter: Sean Hsuan-Yi Chu
>Assignee: Jinfeng Ni
>Priority: Major
> Fix For: Future
>
>
> In DRILL-4372, the logic of ensuring same type is removed since, in some case 
> such as below, undesirable cast function will be added and cause failure.
> {code}
> SELECT * 
> FROM T 
> WHERE (cast(col1 as timestamp)  - to_timestamp(col2,'-MM-dd HH:mm:ss') < 
> interval 'X XX:XX:XX' day to second)
> {code}
> The fundamental reason for this behavior roots in Drill-Calcite [1], where 
> SqlNode WHERE is expanded to a new object but is not passed into validation 
> step.
> [1] 
> https://github.com/mapr/incubator-calcite/blob/DrillCalcite1.4.0-mapr-1.4.0/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3362



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


[jira] [Commented] (DRILL-4642) Let RexBuilder.ensureType() mechanism take place during Rex conversion.

2016-05-04 Thread ASF GitHub Bot (JIRA)

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

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

Github user hsuanyi commented on a diff in the pull request:

https://github.com/apache/drill/pull/489#discussion_r62118608
  
--- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/TypeInferenceUtils.java
 ---
@@ -734,6 +772,41 @@ public static FunctionCall 
convertSqlOperatorBindingToFunctionCall(final SqlOper
   }
 
   /**
+   * Based on whether decimal type is supported or not, this method 
creates an ExplicitOperatorBinding which interprets
+   * the type of decimal literals accordingly.
+   */
+  public static SqlOperatorBinding convertDecimalLiteralToDouble(final 
SqlOperatorBinding sqlOperatorBinding, final boolean isDecimalSupported) {
+final List types = Lists.newArrayList();
+for(int i = 0; i < sqlOperatorBinding.getOperandCount(); ++i) {
+  final RelDataType relDataType;
+  if(isDecimalLiteral(sqlOperatorBinding, i) && !isDecimalSupported) {
+relDataType = createCalciteTypeWithNullability(
+sqlOperatorBinding.getTypeFactory(),
+SqlTypeName.DOUBLE,
+sqlOperatorBinding.getOperandType(i).isNullable());
+  } else {
+relDataType = sqlOperatorBinding.getOperandType(i);
+  }
+  types.add(relDataType);
+}
+return new 
ExplicitOperatorBinding(sqlOperatorBinding.getTypeFactory(), 
sqlOperatorBinding.getOperator(), types);
--- End diff --

addressed.


> Let RexBuilder.ensureType() mechanism take place during Rex conversion.
> ---
>
> Key: DRILL-4642
> URL: https://issues.apache.org/jira/browse/DRILL-4642
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Query Planning & Optimization
>Reporter: Sean Hsuan-Yi Chu
>Assignee: Sean Hsuan-Yi Chu
> Fix For: 1.7.0
>
>
> In DRILL-4372, the logic of ensuring same type is removed since, in some case 
> such as below, undesirable cast function will be added and cause failure.
> {code}
> SELECT * 
> FROM T 
> WHERE (cast(col1 as timestamp)  - to_timestamp(col2,'-MM-dd HH:mm:ss') < 
> interval 'X XX:XX:XX' day to second)
> {code}
> The fundamental reason for this behavior roots in Drill-Calcite [1], where 
> SqlNode WHERE is expanded to a new object but is not passed into validation 
> step.
> [1] 
> https://github.com/mapr/incubator-calcite/blob/DrillCalcite1.4.0-mapr-1.4.0/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3362



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (DRILL-4642) Let RexBuilder.ensureType() mechanism take place during Rex conversion.

2016-05-04 Thread ASF GitHub Bot (JIRA)

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

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

Github user hsuanyi commented on a diff in the pull request:

https://github.com/apache/drill/pull/489#discussion_r62117749
  
--- Diff: 
exec/java-exec/src/test/java/org/apache/drill/TestFunctionsWithTypeExpoQueries.java
 ---
@@ -719,4 +727,73 @@ public void testWindowSumConstant() throws Exception {
 final String[] excludedPlan = {};
 PlanTestBase.testPlanMatchingPatterns(query, expectedPlan, 
excludedPlan);
   }
+
+  @Test // DRILL-4552
+  public void testDecimalPlusWhenDecimalEnabled() throws Exception {
+final String query = "select cast('99' as decimal(9,0)) + cast('99' as 
decimal(9,0)) as col \n" +
+"from cp.`tpch/region.parquet` \n" +
+"limit 0";
+
+try {
+  final TypeProtos.MajorType majorTypeDouble = 
TypeProtos.MajorType.newBuilder()
+  .setMinorType(TypeProtos.MinorType.FLOAT8)
+  .setMode(TypeProtos.DataMode.REQUIRED)
+  .build();
+
+  final List> 
expectedSchemaDouble = Lists.newArrayList();
+  expectedSchemaDouble.add(Pair.of(SchemaPath.getSimplePath("col"), 
majorTypeDouble));
+
+  testBuilder()
--- End diff --

Addressed


> Let RexBuilder.ensureType() mechanism take place during Rex conversion.
> ---
>
> Key: DRILL-4642
> URL: https://issues.apache.org/jira/browse/DRILL-4642
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Query Planning & Optimization
>Reporter: Sean Hsuan-Yi Chu
>Assignee: Sean Hsuan-Yi Chu
> Fix For: 1.7.0
>
>
> In DRILL-4372, the logic of ensuring same type is removed since, in some case 
> such as below, undesirable cast function will be added and cause failure.
> {code}
> SELECT * 
> FROM T 
> WHERE (cast(col1 as timestamp)  - to_timestamp(col2,'-MM-dd HH:mm:ss') < 
> interval 'X XX:XX:XX' day to second)
> {code}
> The fundamental reason for this behavior roots in Drill-Calcite [1], where 
> SqlNode WHERE is expanded to a new object but is not passed into validation 
> step.
> [1] 
> https://github.com/mapr/incubator-calcite/blob/DrillCalcite1.4.0-mapr-1.4.0/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3362



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (DRILL-4642) Let RexBuilder.ensureType() mechanism take place during Rex conversion.

2016-05-04 Thread ASF GitHub Bot (JIRA)

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

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

Github user jinfengni commented on a diff in the pull request:

https://github.com/apache/drill/pull/489#discussion_r62089298
  
--- Diff: 
exec/java-exec/src/test/java/org/apache/drill/TestFunctionsWithTypeExpoQueries.java
 ---
@@ -719,4 +727,73 @@ public void testWindowSumConstant() throws Exception {
 final String[] excludedPlan = {};
 PlanTestBase.testPlanMatchingPatterns(query, expectedPlan, 
excludedPlan);
   }
+
+  @Test // DRILL-4552
+  public void testDecimalPlusWhenDecimalEnabled() throws Exception {
+final String query = "select cast('99' as decimal(9,0)) + cast('99' as 
decimal(9,0)) as col \n" +
+"from cp.`tpch/region.parquet` \n" +
+"limit 0";
+
+try {
+  final TypeProtos.MajorType majorTypeDouble = 
TypeProtos.MajorType.newBuilder()
+  .setMinorType(TypeProtos.MinorType.FLOAT8)
+  .setMode(TypeProtos.DataMode.REQUIRED)
+  .build();
+
+  final List> 
expectedSchemaDouble = Lists.newArrayList();
+  expectedSchemaDouble.add(Pair.of(SchemaPath.getSimplePath("col"), 
majorTypeDouble));
+
+  testBuilder()
--- End diff --

We had better to explicitly set the decimal option to false, before the 
test on line 746. For now, the option defaults to be false. But what if it's 
changed to true some day?




> Let RexBuilder.ensureType() mechanism take place during Rex conversion.
> ---
>
> Key: DRILL-4642
> URL: https://issues.apache.org/jira/browse/DRILL-4642
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Query Planning & Optimization
>Reporter: Sean Hsuan-Yi Chu
>Assignee: Sean Hsuan-Yi Chu
> Fix For: 1.7.0
>
>
> In DRILL-4372, the logic of ensuring same type is removed since, in some case 
> such as below, undesirable cast function will be added and cause failure.
> {code}
> SELECT * 
> FROM T 
> WHERE (cast(col1 as timestamp)  - to_timestamp(col2,'-MM-dd HH:mm:ss') < 
> interval 'X XX:XX:XX' day to second)
> {code}
> The fundamental reason for this behavior roots in Drill-Calcite [1], where 
> SqlNode WHERE is expanded to a new object but is not passed into validation 
> step.
> [1] 
> https://github.com/mapr/incubator-calcite/blob/DrillCalcite1.4.0-mapr-1.4.0/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3362



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (DRILL-4642) Let RexBuilder.ensureType() mechanism take place during Rex conversion.

2016-05-04 Thread ASF GitHub Bot (JIRA)

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

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

Github user jinfengni commented on a diff in the pull request:

https://github.com/apache/drill/pull/489#discussion_r62085424
  
--- Diff: 
exec/java-exec/src/test/java/org/apache/drill/TestFunctionsWithTypeExpoQueries.java
 ---
@@ -213,7 +221,7 @@ public void tesIsNull() throws Exception {
 List> expectedSchema = 
Lists.newArrayList();
 TypeProtos.MajorType majorType = TypeProtos.MajorType.newBuilder()
 .setMinorType(TypeProtos.MinorType.BIT)
-.setMode(TypeProtos.DataMode.REQUIRED)
+.setMode(TypeProtos.DataMode.OPTIONAL)
--- End diff --

why do you have to change the expected result for this query? Should  
"r_name is null" be a required type?  


> Let RexBuilder.ensureType() mechanism take place during Rex conversion.
> ---
>
> Key: DRILL-4642
> URL: https://issues.apache.org/jira/browse/DRILL-4642
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Query Planning & Optimization
>Reporter: Sean Hsuan-Yi Chu
>Assignee: Sean Hsuan-Yi Chu
> Fix For: 1.7.0
>
>
> In DRILL-4372, the logic of ensuring same type is removed since, in some case 
> such as below, undesirable cast function will be added and cause failure.
> {code}
> SELECT * 
> FROM T 
> WHERE (cast(col1 as timestamp)  - to_timestamp(col2,'-MM-dd HH:mm:ss') < 
> interval 'X XX:XX:XX' day to second)
> {code}
> The fundamental reason for this behavior roots in Drill-Calcite [1], where 
> SqlNode WHERE is expanded to a new object but is not passed into validation 
> step.
> [1] 
> https://github.com/mapr/incubator-calcite/blob/DrillCalcite1.4.0-mapr-1.4.0/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3362



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (DRILL-4642) Let RexBuilder.ensureType() mechanism take place during Rex conversion.

2016-05-04 Thread ASF GitHub Bot (JIRA)

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

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

Github user jinfengni commented on a diff in the pull request:

https://github.com/apache/drill/pull/489#discussion_r62084962
  
--- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/TypeInferenceUtils.java
 ---
@@ -734,6 +772,41 @@ public static FunctionCall 
convertSqlOperatorBindingToFunctionCall(final SqlOper
   }
 
   /**
+   * Based on whether decimal type is supported or not, this method 
creates an ExplicitOperatorBinding which interprets
+   * the type of decimal literals accordingly.
+   */
+  public static SqlOperatorBinding convertDecimalLiteralToDouble(final 
SqlOperatorBinding sqlOperatorBinding, final boolean isDecimalSupported) {
+final List types = Lists.newArrayList();
+for(int i = 0; i < sqlOperatorBinding.getOperandCount(); ++i) {
+  final RelDataType relDataType;
+  if(isDecimalLiteral(sqlOperatorBinding, i) && !isDecimalSupported) {
+relDataType = createCalciteTypeWithNullability(
+sqlOperatorBinding.getTypeFactory(),
+SqlTypeName.DOUBLE,
+sqlOperatorBinding.getOperandType(i).isNullable());
+  } else {
+relDataType = sqlOperatorBinding.getOperandType(i);
+  }
+  types.add(relDataType);
+}
+return new 
ExplicitOperatorBinding(sqlOperatorBinding.getTypeFactory(), 
sqlOperatorBinding.getOperator(), types);
--- End diff --

Here we do not have to return a new OperatorBinding. In case there is no 
Decimal -> Double replacement, why can't we return the old binding directly? 


> Let RexBuilder.ensureType() mechanism take place during Rex conversion.
> ---
>
> Key: DRILL-4642
> URL: https://issues.apache.org/jira/browse/DRILL-4642
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Query Planning & Optimization
>Reporter: Sean Hsuan-Yi Chu
>Assignee: Sean Hsuan-Yi Chu
> Fix For: 1.7.0
>
>
> In DRILL-4372, the logic of ensuring same type is removed since, in some case 
> such as below, undesirable cast function will be added and cause failure.
> {code}
> SELECT * 
> FROM T 
> WHERE (cast(col1 as timestamp)  - to_timestamp(col2,'-MM-dd HH:mm:ss') < 
> interval 'X XX:XX:XX' day to second)
> {code}
> The fundamental reason for this behavior roots in Drill-Calcite [1], where 
> SqlNode WHERE is expanded to a new object but is not passed into validation 
> step.
> [1] 
> https://github.com/mapr/incubator-calcite/blob/DrillCalcite1.4.0-mapr-1.4.0/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3362



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (DRILL-4642) Let RexBuilder.ensureType() mechanism take place during Rex conversion.

2016-05-03 Thread Sean Hsuan-Yi Chu (JIRA)

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

Sean Hsuan-Yi Chu commented on DRILL-4642:
--

Drill PR: https://github.com/apache/drill/pull/489
Calcite: https://github.com/hsuanyi/incubator-calcite/tree/DRILL-4642

Note the calcite change above cannot be pushed back to apache calcite since it 
is a followup patch in DrillCalcite, titled

"[StarColumn] Support select * from schema-less table in execution engine like 
Drill. Include support for view, subquery, CTE.  Enable Drill's support of 
select * in View, SubQuery, CTE.  Skip expanding expression in with clause in 
Expander visitor."

> Let RexBuilder.ensureType() mechanism take place during Rex conversion.
> ---
>
> Key: DRILL-4642
> URL: https://issues.apache.org/jira/browse/DRILL-4642
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Query Planning & Optimization
>Reporter: Sean Hsuan-Yi Chu
>Assignee: Sean Hsuan-Yi Chu
> Fix For: 1.7.0
>
>
> In DRILL-4372, the logic of ensuring same type is removed since, in some case 
> such as below, undesirable cast function will be added and cause failure.
> {code}
> SELECT * 
> FROM T 
> WHERE (cast(col1 as timestamp)  - to_timestamp(col2,'-MM-dd HH:mm:ss') < 
> interval 'X XX:XX:XX' day to second)
> {code}
> The fundamental reason for this behavior roots in Drill-Calcite [1], where 
> SqlNode WHERE is expanded to a new object but is not passed into validation 
> step.
> [1] 
> https://github.com/mapr/incubator-calcite/blob/DrillCalcite1.4.0-mapr-1.4.0/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3362



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (DRILL-4642) Let RexBuilder.ensureType() mechanism take place during Rex conversion.

2016-04-28 Thread ASF GitHub Bot (JIRA)

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

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

Github user hsuanyi commented on the pull request:

https://github.com/apache/drill/pull/489#issuecomment-215490190
  
DrillCalcite can be found at here:
https://github.com/hsuanyi/incubator-calcite/tree/DRILL-4642


> Let RexBuilder.ensureType() mechanism take place during Rex conversion.
> ---
>
> Key: DRILL-4642
> URL: https://issues.apache.org/jira/browse/DRILL-4642
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Query Planning & Optimization
>Reporter: Sean Hsuan-Yi Chu
>Assignee: Sean Hsuan-Yi Chu
> Fix For: 1.7.0
>
>
> In DRILL-4372, the logic of ensuring same type is removed since, in some case 
> such as below, undesirable cast function will be added and cause failure.
> {code}
> SELECT * 
> FROM T 
> WHERE (cast(col1 as timestamp)  - to_timestamp(col2,'-MM-dd HH:mm:ss') < 
> interval 'X XX:XX:XX' day to second)
> {code}
> The fundamental reason for this behavior roots in Drill-Calcite [1], where 
> SqlNode WHERE is expanded to a new object but is not passed into validation 
> step.
> [1] 
> https://github.com/mapr/incubator-calcite/blob/DrillCalcite1.4.0-mapr-1.4.0/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3362



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (DRILL-4642) Let RexBuilder.ensureType() mechanism take place during Rex conversion.

2016-04-28 Thread ASF GitHub Bot (JIRA)

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

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

Github user hsuanyi commented on the pull request:

https://github.com/apache/drill/pull/489#issuecomment-215490663
  
@jinfengni Can you help review?


> Let RexBuilder.ensureType() mechanism take place during Rex conversion.
> ---
>
> Key: DRILL-4642
> URL: https://issues.apache.org/jira/browse/DRILL-4642
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Query Planning & Optimization
>Reporter: Sean Hsuan-Yi Chu
>Assignee: Sean Hsuan-Yi Chu
> Fix For: 1.7.0
>
>
> In DRILL-4372, the logic of ensuring same type is removed since, in some case 
> such as below, undesirable cast function will be added and cause failure.
> {code}
> SELECT * 
> FROM T 
> WHERE (cast(col1 as timestamp)  - to_timestamp(col2,'-MM-dd HH:mm:ss') < 
> interval 'X XX:XX:XX' day to second)
> {code}
> The fundamental reason for this behavior roots in Drill-Calcite [1], where 
> SqlNode WHERE is expanded to a new object but is not passed into validation 
> step.
> [1] 
> https://github.com/mapr/incubator-calcite/blob/DrillCalcite1.4.0-mapr-1.4.0/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3362



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (DRILL-4642) Let RexBuilder.ensureType() mechanism take place during Rex conversion.

2016-04-28 Thread ASF GitHub Bot (JIRA)

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

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

GitHub user hsuanyi opened a pull request:

https://github.com/apache/drill/pull/489

DRILL-4642: Remove customized RexBuilder.ensureType()

Bump calcite version to 1.4.0-drill-r12



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/hsuanyi/incubator-drill DRILL-4642

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/drill/pull/489.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #489


commit 163e7b713fbb1a21603f4c1de77acd0481088158
Author: Hsuan-Yi Chu 
Date:   2016-04-25T22:09:01Z

DRILL-4642: Remove customized RexBuilder.ensureType()

Bump calcite version to 1.4.0-drill-r12




> Let RexBuilder.ensureType() mechanism take place during Rex conversion.
> ---
>
> Key: DRILL-4642
> URL: https://issues.apache.org/jira/browse/DRILL-4642
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Query Planning & Optimization
>Reporter: Sean Hsuan-Yi Chu
>Assignee: Sean Hsuan-Yi Chu
> Fix For: 1.7.0
>
>
> In DRILL-4372, the logic of ensuring same type is removed since, in some case 
> such as below, undesirable cast function will be added and cause failure.
> {code}
> SELECT * 
> FROM T 
> WHERE (cast(col1 as timestamp)  - to_timestamp(col2,'-MM-dd HH:mm:ss') < 
> interval 'X XX:XX:XX' day to second)
> {code}
> The fundamental reason for this behavior roots in Drill-Calcite [1], where 
> SqlNode WHERE is expanded to a new object but is not passed into validation 
> step.
> [1] 
> https://github.com/mapr/incubator-calcite/blob/DrillCalcite1.4.0-mapr-1.4.0/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3362



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)