Skip to content

[SPARK-8280][SPARK-8281][SQL]Handle NaN, null and Infinity in math - #7451

Closed
yjshen wants to merge 3 commits into
apache:masterfrom
yjshen:nan_null2
Closed

[SPARK-8280][SPARK-8281][SQL]Handle NaN, null and Infinity in math#7451
yjshen wants to merge 3 commits into
apache:masterfrom
yjshen:nan_null2

Conversation

@yjshen

Copy link
Copy Markdown
Member

@yjshen

Copy link
Copy Markdown
MemberAuthor

Log family semantic comparision:

ExpressionHiveSpark SQL
ln(0.0)NULL-Infinity
ln(-1)NULLNaN

Since we disable udf7 to enable log base between (0.0, 1], we do not have log related comparsion with Hive. So, what about other semantics of Log?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still need + 0.0 here, math.atan2 is calling java.lang.Math.atan2 inside

@yjshen

Copy link
Copy Markdown
MemberAuthor

cc @rxin

@rxin

rxin commented Jul 16, 2015

Copy link
Copy Markdown
Contributor

Let's follow Hive for log, and make sure we add a unit test.

@yjshen

Copy link
Copy Markdown
MemberAuthor

So we behave like Hive except that we do support log base in between (0.0, 1.0], and add a unit test like udf7

@rxin

rxin commented Jul 17, 2015

Copy link
Copy Markdown
Contributor

Yup.

@rxin

rxin commented Jul 17, 2015

Copy link
Copy Markdown
Contributor

Jenkins, add to whitelist.

@rxin

rxin commented Jul 17, 2015

Copy link
Copy Markdown
Contributor

Jenkins, ok to test.

@rxin

rxin commented Jul 17, 2015

Copy link
Copy Markdown
Contributor

Jenkins, test this please.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missed a space here

@rxin

rxin commented Jul 17, 2015

Copy link
Copy Markdown
Contributor

Jenkins, retest this please.

@SparkQA

Copy link
Copy Markdown

Test build #37596 has finished for PR 7451 at commit fb73b87.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • abstract class UnaryLogExpression(f: Double => Double, name: String)
    • case class Log(child: Expression) extends UnaryLogExpression(math.log, "LOG")
    • case class Log10(child: Expression) extends UnaryLogExpression(math.log10, "LOG10")
    • case class Log1p(child: Expression) extends UnaryLogExpression(math.log1p, "LOG1P")

@SparkQA

Copy link
Copy Markdown

Test build #37605 has finished for PR 7451 at commit 003ab23.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class RFormula(override val uid: String)
    • abstract class LeafExpression extends Expression
    • abstract class UnaryExpression extends Expression
    • abstract class BinaryExpression extends Expression
    • abstract class UnaryLogExpression(f: Double => Double, name: String)
    • case class Log(child: Expression) extends UnaryLogExpression(math.log, "LOG")
    • case class Log10(child: Expression) extends UnaryLogExpression(math.log10, "LOG10")
    • case class Log1p(child: Expression) extends UnaryLogExpression(math.log1p, "LOG1P")
    • case class Length(child: Expression) extends UnaryExpression with ExpectsInputTypes
    • case class FormatNumber(x: Expression, d: Expression)
    • abstract class BinaryNode extends LogicalPlan

@yjshen

Copy link
Copy Markdown
MemberAuthor

rebased the code to resolve merge conflicts.

@rxin

rxin commented Jul 17, 2015

Copy link
Copy Markdown
Contributor

Jenkins, retest this please.

@SparkQA

Copy link
Copy Markdown

Test build #37646 has finished for PR 7451 at commit a83b47c.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • abstract class UnsafeProjection extends Projection
    • case class FromUnsafeProjection(fields: Seq[DataType]) extends Projection
    • abstract class BaseProjection extends Projection
    • class SpecificProjection extends $
    • class SpecificProjection extends $
    • abstract class UnaryLogExpression(f: Double => Double, name: String)
    • case class Log(child: Expression) extends UnaryLogExpression(math.log, "LOG")
    • case class Log10(child: Expression) extends UnaryLogExpression(math.log10, "LOG10")
    • case class Log1p(child: Expression) extends UnaryLogExpression(math.log1p, "LOG1P")

@rxin

rxin commented Jul 17, 2015

Copy link
Copy Markdown
Contributor

Oops there is another conflict. I tried resolving this locally but it was a big one. Can you resolve it?

@yjshen

Copy link
Copy Markdown
MemberAuthor

yes, I've resolved it locally, push here again in a minute.

@rxin

rxin commented Jul 17, 2015

Copy link
Copy Markdown
Contributor

Jenkins, retest this please.

1 similar comment
@rxin

rxin commented Jul 17, 2015

Copy link
Copy Markdown
Contributor

Jenkins, retest this please.

@rxin

rxin commented Jul 18, 2015

Copy link
Copy Markdown
Contributor

Thanks - I've merged this.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@yjshen@rxin@SparkQA