Skip to content

[SPARK-3379] Implement 'POWER' for sql #2252

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

Closed
wants to merge 8 commits into from

Conversation

xinyunh
Copy link

@xinyunh xinyunh commented Sep 3, 2014

Add support for the mathematical function "POWER" within spark sql. Test-cases included.
Spitted from [SPARK-3176].

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@SparkQA
Copy link

SparkQA commented Sep 5, 2014

Can one of the admins verify this patch?

@marmbrus
Copy link
Contributor

ok to test

@SparkQA
Copy link

SparkQA commented Sep 16, 2014

QA tests have started for PR 2252 at commit ebe1da9.

  • This patch does not merge cleanly!

@nchammas
Copy link
Contributor

For reference, how does this implementation of POWER() differ from SQL Server's?

Syntax
POWER ( float_expression , y )
Arguments
float_expression: Is an expression of type float or of a type that can be implicitly converted to float.
y: Is the power to which to raise float_expression. y can be an expression of the exact numeric or approximate numeric data type category, except for the bit data type.
Return Types
Returns the same type as submitted in float_expression. For example, if a decimal(2,0) is submitted as float_expression, the result returned is decimal(2,0).

@marmbrus
Copy link
Contributor

Good comparison @nchammas, It odes not look like this implementation currently preserves the input type or supports decimal.

@SparkQA
Copy link

SparkQA commented Sep 16, 2014

QA tests have finished for PR 2252 at commit ebe1da9.

  • This patch fails unit tests.
  • This patch does not merge cleanly!

}
}

val base_v = base.eval(input)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Let's check if base_v is null first and then compute exponent_v, probably performance gains in some cases.

@marmbrus
Copy link
Contributor

marmbrus commented Dec 2, 2014

Thanks for working on this, but we are trying to clean up the PR queue (in order to make it easier for us to review). Thus, I think we should close this issue for now and reopen when its ready for review.

@asfgit asfgit closed this in b0a46d8 Dec 2, 2014
Sign up for free to 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.

6 participants