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-9644] [SQL] Support update DecimalType with precision > 18 in UnsafeRow #7978

Closed
wants to merge 5 commits into from

Conversation

davies
Copy link
Contributor

@davies davies commented Aug 6, 2015

In order to support update a varlength (actually fixed length) object, the space should be preserved even it's null. And, we can't call setNullAt(i) for it anymore, we because setNullAt(i) will remove the offset of the preserved space, should call setDecimal(i, null, precision) instead.

After this, we can do hash based aggregation on DecimalType with precision > 18. In a tests, this could decrease the end-to-end run time of aggregation query from 37 seconds (sort based) to 24 seconds (hash based).

cc @rxin

@SparkQA
Copy link

SparkQA commented Aug 6, 2015

Test build #1374 has finished for PR 7978 at commit cd6c524.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

}
"""
} else {
s"""
if (${ev.isNull}) {
$output.setNullAt($i);
} else {
$update;
}
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

this is aligned really weirdly right now

@rxin
Copy link
Contributor

rxin commented Aug 6, 2015

LGTM other than that.

@SparkQA
Copy link

SparkQA commented Aug 6, 2015

Test build #1376 has finished for PR 7978 at commit 923c9eb.

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

@davies
Copy link
Contributor Author

davies commented Aug 6, 2015

I'm merging this into master and 1.5 branch.

asfgit pushed a commit that referenced this pull request Aug 6, 2015
…UnsafeRow

In order to support update a varlength (actually fixed length) object, the space should be preserved even  it's null. And, we can't call setNullAt(i) for it anymore, we because setNullAt(i) will remove the offset of the preserved space, should call setDecimal(i, null, precision) instead.

After this, we can do hash based aggregation on DecimalType with precision > 18. In a tests, this could decrease the end-to-end run time of aggregation query from 37 seconds (sort based) to 24 seconds (hash based).

cc rxin

Author: Davies Liu <davies@databricks.com>

Closes #7978 from davies/update_decimal and squashes the following commits:

bed8100 [Davies Liu] isSettable -> isMutable
923c9eb [Davies Liu] address comments and fix bug
385891d [Davies Liu] Merge branch 'master' of github.com:apache/spark into update_decimal
36a1872 [Davies Liu] fix tests
cd6c524 [Davies Liu] support set decimal with precision > 18

(cherry picked from commit 5b965d6)
Signed-off-by: Davies Liu <davies.liu@gmail.com>
@asfgit asfgit closed this in 5b965d6 Aug 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants