-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Decimal arithmetic and logical functions e2e tests #18320
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
Decimal arithmetic and logical functions e2e tests #18320
Conversation
874d2de to
1ba5b46
Compare
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.
The coverage looks good. Will be nice to add a few with bounds.
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.
I feel reviewers might be confused as to why the type is DECIMAL(35,20) when none of the inputs carry that. Should we simply say decimal '999999999999999.999' like below and clarify that the inferred column type is DECIMAL(35,20)
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.
Do we need cast? can we simply say decimal '99999999999999999999999999999999999999'?
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.
Should we add a test between decimal limits? between [min, max] and [max, min].
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.
Test limits here and other functions below?
02d58d0 to
751afab
Compare
751afab to
5cdf680
Compare
45c1687 to
23d899e
Compare
fdfa0ce to
fae254a
Compare
9ad5b3a to
825b0f5
Compare
825b0f5 to
69e8f72
Compare
7d95dd0 to
5c28826
Compare
5c28826 to
ed382d0
Compare
|
@mbasmanova @kagamiori Would you please review this. I had to remove the "Decimal overflow" related tests and I have explained in the description. |
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.
Hi Karteek, Queries that process only literal values like this may be constant folded by Prestissimo coordinator without invoking Velox evaluation. Could you try selecting from columns instead of literal values only? (cc @amitkdutta)
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.
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.
My concern is that the constant folding may use Presto's code instead of Velox code (that you would like to test IIUC). Let me try if I can verify this locally.
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.
The concern is valid. From what I understand if the plan says there is a SUBTRACT operator, then that is what gets executed in the backend. Or else, we would just see a project node. CMIW.
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.
@kagamiori did you get a chance to verify this?
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.
Hi @karteekmurthys, I'm having trouble running the e2e query on my laptop (due to my setup of Prestissimo). I'm asking @amitkdutta and @mbasmanova to help confirm.
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.
@karteekmurthys Karteek, to speed up the review, would you share the output of EXPLAIN (TYPE DISTRIBUTED) command for one of these queries?
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.
presto:default> explain (type distributed) SELECT n - m from (values (CAST('999999999999999.999' as decimal(18,3)), CAST('1' as decimal(1,0)))) t(n, m);
Query Plan
--------------------------------------------------------------------------------------------
Fragment 0 [SINGLE] +
Output layout: [expr_6] +
Output partitioning: SINGLE [] +
Stage Execution Strategy: UNGROUPED_EXECUTION +
- Output[_col0] => [expr_6:decimal(19,3)] +
Estimates: {rows: 1 (17B), cpu: 35.00, memory: 0.00, network: 0.00} +
_col0 := expr_6 (1:37) +
- Project[projectLocality = LOCAL] => [expr_6:decimal(19,3)] +
Estimates: {rows: 1 (17B), cpu: 35.00, memory: 0.00, network: 0.00} +
expr_6 := (field) - (field_0) (1:48) +
- LocalExchange[ROUND_ROBIN] () => [field:decimal(18,3), field_0:decimal(1,0)]+
Estimates: {rows: 1 (18B), cpu: 18.00, memory: 0.00, network: 0.00} +
- Values => [field:decimal(18,3), field_0:decimal(1,0)] +
Estimates: {rows: 1 (18B), cpu: 0.00, memory: 0.00, network: 0.00}+
(DECIMAL'999999999999999.999', DECIMAL'1') +
+
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.
@karteekmurthys Thanks. This plan shows that the computation (a - b) will happen on the worker.
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.
Thanks @mbasmanova for confirming!
kagamiori
left a comment
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.
LGTM. Thank you for adding the test!
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.
Thanks @mbasmanova for confirming!
|
There is a failure of "product test (basic)". Please resolve it before landing the code. |
|
@kagamiori The e2e tests are executed in test native / build-and-test (pull_request) which is green and the failures seem unrelated to this change. A different test fails each time, not necessarily related to this change. I will try to rerun again. |
ed382d0 to
2c9d0ee
Compare
|
@kagamiori @mbasmanova there is one failure, which is unrelated: Let me know if this is a blocker to merge this PR. |
2c9d0ee to
10844d2
Compare
|
@tdcmeehan @highker Tim, James, is it expected to have intermittent test failures? What should we do in these cases? |
|
@mbasmanova @tdcmeehan just following up on this. |
|
@mbasmanova Can you help merge this? Thanks a lot! |
|
@yzhang1991 I see that Aditi already merged this PR. Thank you, Aditi. |

Test plan -
Run and compare SQL queries with Decimal Arithmetic operations on PrestoDB and PrestoCPP.
Removed "Decimal overflow" related tests as they trigger this issue in Prestissimo. Will re-add them once that issue is fixed.