Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/6725#discussion_r32375557
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/MathFunctionsSuite.scala
---
@@ -204,4 +204,22 @@ class MathFunctionsSuite extends SparkFunSuite with
ExpressionEvalHelper {
testBinary(Atan2, math.atan2)
}
+ test("binary log") {
+ val f = (c1: Double, c2: Double) => math.log(c2) / math.log(c1)
+ val domain = (1 to 20).map(v => (v * 0.1, v * 0.2))
+
+ domain.foreach { case (v1, v2) =>
+ checkEvaluation(Logarithm(Literal(v1), Literal(v2)), f(v1 + 0.0, v2
+ 0.0), EmptyRow)
+ checkEvaluation(Logarithm(Literal(v2), Literal(v1)), f(v2 + 0.0, v1
+ 0.0), EmptyRow)
+ }
+ // When base is null, Logarithm is 10-based log.
--- End diff --
if the 1st argument is null, we definitely shouldn't use 10 base
implicitly. can you take a look at what hive returns in that case? maybe just
null.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]