Open kagamiori opened 1 year ago
Here, common path does constant folding turning map_values(null) into a null constant. It then attempts to create an instance of a stateful vector function InPredicate with a constant null second argument. The creation throws. Common path doesn't do constant folding and creates an instance of InPredicate with no constant inputs. The creation succeeds. Common path then evaluates inputs to "in" function, eliminates rows where at least one of the inputs is null (in this case all rows are eliminated because second argument is null) and return nulls without calling InPredicate.
First, failures during creation of InPredicate need to be suppressed and re-thrown (via context.setErrors(rows, exception)
) if and when InPredicate::apply is called.
Second, constant folding should be more powerful and apply to function calls with constant null inputs. If these have default null behavior they can be constant folded into a null.
CC: @laithsakka @kagamiori @bikramSingh91
@oerling Orri offered to help with this one.
Part of the fix: #3050
Second, constant folding should be more powerful and apply to function calls with constant null inputs. If these have default null behavior they can be constant folded into a null.
I had a PR for the second part back in August: https://github.com/facebookincubator/velox/pull/2007. It was blocked by fuzzer test failures that have the same root cause as https://github.com/facebookincubator/velox/issues/2749 which has been fixed by https://github.com/facebookincubator/velox/pull/2961 recently.
Second, constant folding should be more powerful and apply to function calls with constant null inputs. If these have default null behavior they can be constant folded into a null.
I had a PR for the second part back in August: #2007. It was blocked by fuzzer test failures that have the same root cause as #2749 which has been fixed by #2961 recently.
OK, the PR #2007 is blocked by another fuzzer test failure again (https://github.com/facebookincubator/velox/issues/3060). The failure can be reproduced via the following command.
buck-out/gen/velox/expression/tests/velox_expression_fuzzer_test --only "date_format,from_unixtime,replace,chr,substr,regexp_replace,regexp_extract,split_part,url_extract_path,lpad,strrpos,strpos,bitwise_and,truncate,rpad,to_base64,sha512" --seed 2869762080
Possible fix from @oerling #3189
There are two ways to reproduce this error.
velox/expression/tests/velox_expression_runner_test --input_path "/home/weihe/fuzzer_repro/velox_vector_xWVO02" --sql_path "/home/weihe/fuzzer_repro/velox_sql_1KLk7v" --result_path "/home/weihe/fuzzer_repro/velox_vector_yChHFS"
(change the file paths to yours).078ffeddc
and then runvelox/expression/tests/velox_expression_fuzzer_test --velox_fuzzer_enable_complex_types --velox_fuzzer_max_level_of_nesting 2 --only "array_position,in,map_values" --seed 2768396557
.