Repository navigation
DX-128819: [C++][Gandiva] Validate the input expression of IN (cherry-pick apache/arrow#55609) - #175
Merged
lriggs merged 1 commit intoDec 1, 2026
Conversation
…on of IN (apache#55609) `ExprValidator` checks the value list of `IN` but not its input expression. An `IF` with an `int32` condition is rejected alone and accepted under `IN`. A null input crashes `Projector::Make` with SIGSEGV. The PR has the tests first, then the fix in `expr_validator.cc` and `node.h`. `ValidateInExpression` checks that the input and its type are not null, and visits the input. `InExpressionNode::ToString()` prints `null` for a null input, so the cache key does not crash before validation. Yes. The new tests cover invalid, null and untyped input for all `IN` value types, with `Projector::Make` and `Filter::Make`, and a valid `IN`. On main, one of them fails and two crash with SIGSEGV. All of them pass with the fix. `Make` now returns `ExpressionValidationError` for an `IN` with an invalid or null input. Before, it accepted it or crashed. **This PR contains a "Critical Fix".** It fixes a crash. `Projector::Make` and `Filter::Make` die with SIGSEGV (exit code 139) when the input expression of an `IN` node is null. The null pointer is dereferenced in `InExpressionNode::ToString()`, which the cache key calls before the validator runs. Both `Make` calls now return `ExpressionValidationError`. AI tools helped investigate the bug and write the fix, tests, and description. **PR code and description written by:** - [x] Human - [x] AI **Reviewed before submission by:** - [x] Human - [ ] AI - [ ] Not reviewed * GitHub Issue: apache#55615 Authored-by: Dmitry Chirkov <dmitry.chirkov@dremio.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com> (cherry picked from commit 1140d8e)
victor6567758
marked this pull request as ready for review
December 1, 2026 13:00
victor6567758
requested review from
akravchukdremio,
dmitry-chirkov-dremio,
lriggs and
xxlaykxx
as code owners
December 1, 2026 13:00
lriggs
approved these changes
Dec 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cherry-pick of apache#55609 (
1140d8e35c1a5dc7eb32515255f12816ba4a0dec, merged 2026-11-27) intodremio_27.0_26_20. Same change as #174 (dremio_27.0_23_19).apacheGH-55615: Gandiva
ExprValidatordid not validate the input expression ofIN, and a null input expression crashedProjector::Makewith SIGSEGV (InExpressionNode::ToString()dereferenced it before validation).ToString()printsnullfor a null inputProjector::Make/Filter::MakereturnExpressionValidationErrorinstead of crashingJira: DX-128819
Files
cpp/src/gandiva/expr_validator.cccpp/src/gandiva/node.hcpp/src/gandiva/tests/projector_build_validation_test.cc(4 new tests)Cherry-picked with
-x, upstream author preserved.Testing
C++ unit tests (
gandiva-projector-test --gtest_filter='*TestInExpression*', run on thedremio_27.0_26_20branch, same change on both):TestInExpressionValidatesEvalExpressionfails andTestInExpressionNullEvalExpressioncrashes with SIGSEGVJarBuild (dremio/arrow-java, built from this PR branch):
orc-2.2.1.tar.gzfrom archive.apache.org in the arm64 job, unrelated to the change), tagv20.0.0-10b29ca-52a411fcustom-arrow-gandiva-build#1606 published to Nexus:arrow.version=20.0.0-20261130231042-10b29ca-52a411f-dremioDremio-side regression check (local Dremio on
master(consumer of this branch) with the jar above): 9 queries withIN(column, arithmetic, CASE, function, varchar, date, decimal, WHERE IN, NOT IN with NULL) run with Gandiva (exec.gandiva.optimize_irfalse/true) and Java codegen. All results identical, no errors in the server log. A null/invalidINinput cannot be created from SQL (the planner type-checks first), so the crash itself is covered by the C++ tests only.