Skip to content

Conversation

@berkaysynnada
Copy link
Contributor

Which issue does this PR close?

Closes #.

Rationale for this change

After ProjectionExec is able to propagate the orders of non-column expressions, it is also possible to preserve the order of some ScalarFunctionExpr's. This PR implements that feature.

This PR is the 3rd step of #7296 and #7364 PR's. Now, we have the support of propagating the sort order over different kinds of PhysicalExpr's at the projection stage.

What changes are included in this PR?

While creating ScalarFunctionExpr, we check its order preservation info from BuiltinScalarFunction. math_expressions and datetime_expressions are labeled according to their functional monotonicity. ScalarFunctionExpr now has a field monotonicity: Option<FuncMonotonicity>. FuncMonotonicity keeps monotonicity information of the function. It is one to one mapped to args of the function, and it specifies the effect of an increase or decrease in the corresponding arg to the function value.

Are these changes tested?

Yes, by .slt tests with some of the functions.

Are there any user-facing changes?

@github-actions github-actions bot added physical-expr Changes to the physical-expr crates sqllogictest SQL Logic Tests (.slt) labels Aug 25, 2023
@alamb
Copy link
Contributor

alamb commented Aug 25, 2023

I believe CI will pass after merging up from main to get the change in #7416

@berkaysynnada
Copy link
Contributor Author

@alamb I have synced the branch. If no objection, the PR is ready to merge.

Copy link
Contributor

@ozankabak ozankabak left a comment

Choose a reason for hiding this comment

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

LGTM, any feedback @alamb?

@ozankabak
Copy link
Contributor

There doesn't seem to be any concerns about this, so I will go ahead with merging. Should there be any issues, we will address via quick follow-on PRs.

@ozankabak ozankabak merged commit fc1fd9b into apache:main Sep 3, 2023
@berkaysynnada berkaysynnada deleted the feature/scalar-func-expr-ordering branch September 4, 2023 08:11
@alamb
Copy link
Contributor

alamb commented Sep 5, 2023

LGTM, any feedback @alamb?

Sorry I was on vacation -- thanks for merging it and moving things along!

Copy link
Contributor

@alamb alamb 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 -- thanks @berkaysynnada

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-expr Changes to the physical-expr crates sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants