Skip to content

Commit

Permalink
Make sure inputFlatNoNulls_ is initialized in EvalCtx ctor (facebooki…
Browse files Browse the repository at this point in the history
…ncubator#11140)

Summary:
Pull Request resolved: facebookincubator#11140

when `inputFlatNoNulls_` is not initialized, it could result in undefined behavior like one described in https://www.internalfb.com/diff/D63556283?dst_version_fbid=804905691596581&transaction_fbid=550949777494622

This diff initializes inputFlatNoNulls_ as false.

Reviewed By: xiaoxmeng

Differential Revision: D63673714

fbshipit-source-id: f48c4f2ed1e0a3389c0a72fb662390986606553c
  • Loading branch information
Mingyu Zhang authored and facebook-github-bot committed Oct 4, 2024
1 parent 2b25d86 commit e8db673
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions velox/expression/EvalCtx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ EvalCtx::EvalCtx(core::ExecCtx* execCtx, ExprSet* exprSet, const RowVector* row)
EvalCtx::EvalCtx(core::ExecCtx* execCtx)
: execCtx_(execCtx), exprSet_(nullptr), row_(nullptr) {
VELOX_CHECK_NOT_NULL(execCtx);
inputFlatNoNulls_ = false;
}

void EvalCtx::saveAndReset(ContextSaver& saver, const SelectivityVector& rows) {
Expand Down
5 changes: 5 additions & 0 deletions velox/expression/tests/EvalCtxTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,8 @@ TEST_F(EvalCtxTest, localSingleRow) {
}
}
}

TEST_F(EvalCtxTest, inputFlatNoNulls) {
EvalCtx context(&execCtx_);
ASSERT_FALSE(context.inputFlatNoNulls());
}

0 comments on commit e8db673

Please sign in to comment.