Skip to content

Optimize lambda body when possible#13650

Merged
highker merged 2 commits intoprestodb:masterfrom
hellium01:FixRegression
Nov 28, 2019
Merged

Optimize lambda body when possible#13650
highker merged 2 commits intoprestodb:masterfrom
hellium01:FixRegression

Conversation

@hellium01
Copy link
Contributor

Commit 98f05bf deprecated ExpressionOptimizer without porting the
handling of lambda body into RowExpressionInterpreter. This commit
added optimization on Lambda definition body so that expensive
operation within lambda can be replaced with constant.

Fixes #13648

== RELEASE NOTES ==

General Changes
* Fix regression on lambda evaluation (Issue#13648).

@hellium01 hellium01 requested a review from wenleix November 5, 2019 00:34
@hellium01 hellium01 requested a review from arhimondr November 5, 2019 00:34
@hellium01 hellium01 requested a review from highker November 5, 2019 00:35
@hellium01 hellium01 force-pushed the FixRegression branch 2 times, most recently from 155050d to 6fd41bc Compare November 5, 2019 00:39
Copy link

@highker highker left a comment

Choose a reason for hiding this comment

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

oops, test failure is related

@hellium01 hellium01 force-pushed the FixRegression branch 2 times, most recently from 0eccbb7 to 05139b7 Compare November 5, 2019 21:02
@hellium01 hellium01 requested a review from highker November 6, 2019 22:06
@hellium01 hellium01 force-pushed the FixRegression branch 2 times, most recently from a3a34b8 to c36ffbc Compare November 6, 2019 22:10
@hellium01
Copy link
Contributor Author

Thanks, fixed the issue in commit a0cab3cbff11c6a7185fc9d7e306b6478fc6ad53.

Copy link

@highker highker left a comment

Choose a reason for hiding this comment

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

minor comments only

@highker
Copy link

highker commented Nov 7, 2019

There is an extra "dot" at the end of your first commit message body

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 8, 2019

CLA Check
The committers are authorized under a signed CLA.

  • ✅ Yi He (e02d559e11034abb773677796805bae22e17d946, d0c4da8c60492f2e4c3acddac664d97f22cf239f)

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you just use expectedExceptions = PrestoException.class, ...?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using @Test's expectedExceptions, we cannot match the error code, which is something we want to test here as well.

Copy link
Contributor

@wenleix wenleix left a comment

Choose a reason for hiding this comment

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

Looks good to me. @highker and @rongrong , wondering if you have any further comments?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can now remove the TODO comment above since we implement it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are still not evaluating lambda (only have optimized its body) yet :) Lambda functions was treated as non-deterministic.

Currently, the error code is fixed to GENERIC_USER_ERROR, we need
correct error code to be able to correctly do dispatching later.
Commit 98f05bf deprecated ExpressionOptimizer without porting the
handling of lambda body into RowExpressionInterpreter. This commit
added optimization on Lambda definition body so that expensive
operation within lambda can be replaced with constant.
Copy link

@highker highker left a comment

Choose a reason for hiding this comment

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

LGTM. @wenleix @rongrong any extra comments?

@highker highker merged commit 9aa8f80 into prestodb:master Nov 28, 2019
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.

Lambda body is not optimized after RowExpression refactor

5 participants