DonnyZone commented on a change in pull request #1347: [CALCITE-3224] New 
RexNode-to-Expression CodeGen Implementation
URL: https://github.com/apache/calcite/pull/1347#discussion_r310126096
 
 

 ##########
 File path: core/src/test/java/org/apache/calcite/test/ReflectiveSchemaTest.java
 ##########
 @@ -581,6 +581,12 @@ private void check(ResultSetMetaData metaData, String 
columnName,
         CalciteAssert.that().withSchema("s", CATCHALL);
     with.query("select \"wrapperLong\" / \"primitiveLong\" as c\n"
         + " from \"s\".\"everyTypes\" where \"primitiveLong\" <> 0")
+        .planContains(
+            "final Long input_value = current.wrapperLong;")
+        .planContains(
+            "final boolean input_isNull = input_value == null;")
+        .planContains(
+            "return input_isNull ? (Long) null : Long.valueOf(input_isNull ? 
0L : input_value / Long.valueOf(current.primitiveLong));")
 
 Review comment:
   Current implementation conduct a step-by-step manner, maybe the 
non-optimized code is more intuitive.
   
   **public Object current() {
        final org.apache.calcite.test.ReflectiveSchemaTest.EveryType current = 
(org.apache.calcite.test.ReflectiveSchemaTest.EveryType) 
inputEnumerator.current();
        final Long input_value = current.wrapperLong;
        final boolean input_isNull = input_value == null;
        final long input_value0 = current.primitiveLong;
        final boolean input_isNull0 = false;
        final long binary_call_value = input_isNull || input_isNull0 ? 0L : 
input_value / Long.valueOf(input_value0);
        final boolean binary_call_isNull = input_isNull || input_isNull0;
        final Long result = binary_call_isNull ? (Long) null : 
Long.valueOf(binary_call_value);
        return result;
    }**
   
   The implementation introduces some patterns that need be optimized in 
BlockBuilder.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to