Skip to content
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

[SPARK-9759] [SQL] improve decimal.times() and cast(int, decimalType) #8052

Closed
wants to merge 1 commit into from

Conversation

davies
Copy link
Contributor

@davies davies commented Aug 8, 2015

This patch optimize two things:

  1. passing MathContext to JavaBigDecimal.multiply/divide/reminder to do right rounding, because java.math.BigDecimal.apply(MathContext) is expensive
  2. Cast integer/short/byte to decimal directly (without double)

This two optimizations could speed up the end-to-end time of a aggregation (SUM(short * decimal(5, 2)) 75% (from 19s -> 10.8s)

@SparkQA
Copy link

SparkQA commented Aug 9, 2015

Test build #40246 has finished for PR 8052 at commit 225efad.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@davies
Copy link
Contributor Author

davies commented Aug 10, 2015

@JoshRosen Does this small patch look good to you?

@rxin
Copy link
Contributor

rxin commented Aug 10, 2015

LGTM

asfgit pushed a commit that referenced this pull request Aug 10, 2015
This patch optimize two things:

1. passing MathContext to JavaBigDecimal.multiply/divide/reminder to do right rounding, because java.math.BigDecimal.apply(MathContext) is expensive

2. Cast integer/short/byte to decimal directly (without double)

This two optimizations could speed up the end-to-end time of a aggregation (SUM(short * decimal(5, 2)) 75% (from 19s -> 10.8s)

Author: Davies Liu <[email protected]>

Closes #8052 from davies/optimize_decimal and squashes the following commits:

225efad [Davies Liu] improve decimal.times() and cast(int, decimalType)

(cherry picked from commit c4fd2a2)
Signed-off-by: Reynold Xin <[email protected]>
@asfgit asfgit closed this in c4fd2a2 Aug 10, 2015
CodingCat pushed a commit to CodingCat/spark that referenced this pull request Aug 17, 2015
This patch optimize two things:

1. passing MathContext to JavaBigDecimal.multiply/divide/reminder to do right rounding, because java.math.BigDecimal.apply(MathContext) is expensive

2. Cast integer/short/byte to decimal directly (without double)

This two optimizations could speed up the end-to-end time of a aggregation (SUM(short * decimal(5, 2)) 75% (from 19s -> 10.8s)

Author: Davies Liu <[email protected]>

Closes apache#8052 from davies/optimize_decimal and squashes the following commits:

225efad [Davies Liu] improve decimal.times() and cast(int, decimalType)
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.

3 participants