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

[6X] Fix FNullRejecting() error while trying to process zero-placed predicate #13172

Merged

Conversation

InnerLife0
Copy link
Contributor

When trying to do NULL rejection over zero-placed predicate, e.g. any strict function with zero arguments, we may pass NULL children array from EberEvaluate() to underlying Eber() functions. This may lead to errors, such as assertion error at EberNullOnAnyNullChild() function which used by many subclasses. As underlying Eber() functions doesn't perform any NULL check, we need to pass an empty array to them in case we working with zero-placed predicate.
Another option was to return EberAny from EberEvaluate() in case we dealing with zero arity, but there is underlying CScalarConst::Eber() function which should be called and which do it's stuff ignoring incoming argument at all. Here I decided to keep current solution as it's clean.

A little highlighting of function folding. If you'll remove topmost select from any of new tests, you'll not get an error because strict function will be folded, and thus, became Const. Starting from 4cf4743 such functions under topmost select not folded, because such select has no parse->rtable. At the other hand, Postgres planner, on which ORCA fell back before current patch, can do folding because of separate calls to eval_const_expressions() from subplans

@bhuvnesh2703
Copy link
Contributor

Thank your @InnerLife0 for the contribution. I will take it to the Review Committee to approve / disapprove it for 6X.

@InnerLife0 InnerLife0 force-pushed the nullrejecting_error_zero_arity branch from ff167db to 84f4989 Compare March 25, 2022 04:44
@InnerLife0
Copy link
Contributor Author

InnerLife0 commented Mar 28, 2022

Changed minidump.
I'll squash all commits once again if all is OK.

@bhuvnesh2703
Copy link
Contributor

Got Approval. Please squash it, and i can merge afterwards.

…ate.

When trying to do NULL rejection over zero-placed predicate, e.g. any strict function with zero arguments, we may pass NULL children array from EberEvaluate() to underlying Eber() functions. This may lead to errors, such as assertion error at EberNullOnAnyNullChild() function which used by many subclasses. As underlying Eber() functions doesn't perform any NULL check, we need to pass an empty array to them in case we working with zero-placed predicate.
Another option was to return EberAny from EberEvaluate() in case we dealing with zero arity, but there is underlying CScalarConst::Eber() function which should be called and which do it's stuff ignoring incoming argument at all. Here I decided to keep current solution as it's clean.

A little highlighting of function folding. If you'll remove topmost select from any of new tests, you'll not get an error because strict function will be folded, and thus, became Const. Starting from 4cf4743 such functions under topmost select not folded, because such select has no parse->rtable. At the other hand, Postgres planner, on which ORCA fell back before current patch, can do folding because of separate calls to eval_const_expressions() from subplans.
@InnerLife0 InnerLife0 force-pushed the nullrejecting_error_zero_arity branch from da0d449 to e27ab38 Compare March 29, 2022 04:41
@InnerLife0
Copy link
Contributor Author

InnerLife0 commented Mar 29, 2022

Squashed. CI is OK.

@bhuvnesh2703 bhuvnesh2703 merged commit edbc723 into greenplum-db:6X_STABLE Mar 31, 2022
@Stolb27 Stolb27 deleted the nullrejecting_error_zero_arity branch April 5, 2022 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants