-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-8218][SQL] Add binary log math function #6725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
f373bac
c795342
c6c187f
21c3bfd
605574d
ebc9929
23c54a3
5b39c02
3d75bfc
1750034
0634ef7
db7dc38
bc89597
8cf37b7
6089d11
beed631
fd01863
102070d
bf96bd9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -204,7 +204,7 @@ case class Pow(left: Expression, right: Expression) | |
| } | ||
|
|
||
| object Logarithm { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need this? We should assume people will use the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because we want to support the usage of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. take a look at #6806
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok. it solves this problem. |
||
| def apply(exprs: Seq[Expression]) = { | ||
| def apply(exprs: Seq[Expression]): Expression = { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't need this one do we? just need an apply with one argument, along with the original case class' constructor. |
||
| if (exprs.length == 1) { | ||
| new Log(exprs(0)) | ||
| } else if (exprs.length == 2) { | ||
|
|
@@ -213,7 +213,7 @@ object Logarithm { | |
| sys.error(s"Log only accepts two input expressions") | ||
| } | ||
| } | ||
| def apply(child: Expression) = new Log(child) | ||
| def apply(child: Expression): Expression = new Log(child) | ||
| } | ||
|
|
||
| case class Logarithm(left: Expression, right: Expression) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We seem to be doing this throughout the file, but it seems pretty confusing to me to be using
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh - one thing is that left/right is coming from BinaryExpression
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that is what I meant saying it wasn't worth whatever code reuse we are getting. The other option would be to name the arguments and have
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inheriting from |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,6 +96,7 @@ class DataFrameFunctionsSuite extends QueryTest { | |
| checkAnswer( | ||
| df.select(org.apache.spark.sql.functions.log("a"), | ||
|
||
| org.apache.spark.sql.functions.log(2.0, "a"), | ||
| org.apache.spark.sql.functions.log("b")), Row(math.log(123), math.log(123) / math.log(2), null)) | ||
| org.apache.spark.sql.functions.log("b")), | ||
| Row(math.log(123), math.log(123) / math.log(2), null)) | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we define this function directly instead of using this magic?