tanclary commented on code in PR #3099:
URL: https://github.com/apache/calcite/pull/3099#discussion_r1150858978


##########
core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java:
##########
@@ -3684,6 +3687,43 @@ private static class LogicalNotImplementor extends 
AbstractRexCallImplementor {
     }
   }
 
+  /**Implementor for the {@code LN, LOG, and LOG10} operators

Review Comment:
   Done.



##########
core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java:
##########
@@ -3684,6 +3687,43 @@ private static class LogicalNotImplementor extends 
AbstractRexCallImplementor {
     }
   }
 
+  /**Implementor for the {@code LN, LOG, and LOG10} operators
+   *
+   * <p>Handles all logarithm functions using log rules to determine the
+   * appropriate base (i.e. base e for LN).
+   */
+  private static class LogImplementor extends AbstractRexCallImplementor {
+    LogImplementor() {
+      super("log", NullPolicy.STRICT, true);
+    }
+
+    @Override Expression implementSafe(final RexToLixTranslator translator,
+        final RexCall call, final List<Expression> argValueList) {
+      Expression operand0 = argValueList.get(0);
+      Expression operand1;
+
+      switch (call.getOperator().getName()) {
+      case "LN":
+        operand1 = Expressions.constant(Math.exp(1));
+        break;
+      case "LOG":
+        switch (argValueList.size()) {
+        case 1:
+          operand1 = Expressions.constant(Math.exp(1));
+          break;
+        default:
+          operand1 = argValueList.get(1);
+        }
+        break;
+      case "LOG10":
+      default:

Review Comment:
   Done.



-- 
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