Skip to content

Commit

Permalink
Fix FNullRejecting() error while trying to process zero-placed predic…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
Alexey Gordeev authored and my-ship-it committed Nov 1, 2024
1 parent 8dffe76 commit 209f897
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/test/regress/sql/gporca.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3517,7 +3517,6 @@ ON t1.tradingday = t2.tradingday;

DROP TABLE t_clientinstrumentind2, t_clientproductind2;


---------------------------------------------------------------------------------
-- Test ALL NULL scalar array compare
create table DatumSortedSet_core (a int, b character varying NOT NULL) distributed by (a);
Expand Down

0 comments on commit 209f897

Please sign in to comment.