Michael Ho has posted comments on this change. Change subject: IMPALA-5246: MemTestClose() should handle Expr's preparation failure ......................................................................
Patch Set 5: (6 comments) The existing code wasn't quite consistent about checking for null before calling FunctionContextImpl::Free() (e.g. UdfBuiltins::TruncClose()). The new patch now removes all null check before calling FunctionContextImpl::Close() and delete. Also set the FunctionContext states to nullptr after freeing them. I did a quick audit of all the Close() functions in our built-ins and didn't see any potential nullptr dereference. http://gerrit.cloudera.org:8080/#/c/6757/1//COMMIT_MSG Commit Message: PS1, Line 10: . > Put a period here Done http://gerrit.cloudera.org:8080/#/c/6757/1/be/src/exprs/case-expr.cc File be/src/exprs/case-expr.cc: PS1, Line 82: st<uint8_t*>(case_state)); > I could be wrong, but shouldn't we call Close() is supposed to be called once per ExprContext so the code is not supposed to be calling fn_ctx->Free() on the same FunctionContext twice. Moreover, it's not entirely clear to me Close() is really idempotent (e.g. calling close_fn_() on ScalarFnCall() may have unexpected side effect). That said, it still seems like a good practice to set the THREAD_LOCAL_STATE to nullptr after freeing it. Thanks for the suggestion. http://gerrit.cloudera.org:8080/#/c/6757/1/be/src/exprs/math-functions-ir.cc File be/src/exprs/math-functions-ir.cc: PS1, Line 182: > same here Done http://gerrit.cloudera.org:8080/#/c/6757/1/be/src/exprs/string-functions-ir.cc File be/src/exprs/string-functions-ir.cc: PS1, Line 614: terpret_ca > same here Done http://gerrit.cloudera.org:8080/#/c/6757/1/be/src/exprs/timestamp-functions.cc File be/src/exprs/timestamp-functions.cc: PS1, Line 195: > same here Done http://gerrit.cloudera.org:8080/#/c/6757/1/be/src/exprs/utility-functions.cc File be/src/exprs/utility-functions.cc: PS1, Line 59: > same here Done -- To view, visit http://gerrit.cloudera.org:8080/6757 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id2c689246ed4f8dd38f104fa35904f3926a7039c Gerrit-PatchSet: 5 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Michael Ho <k...@cloudera.com> Gerrit-Reviewer: Attila Jeges <atti...@cloudera.com> Gerrit-Reviewer: Dan Hecht <dhe...@cloudera.com> Gerrit-Reviewer: Michael Ho <k...@cloudera.com> Gerrit-Reviewer: Taras Bobrovytsky <tbobrovyt...@cloudera.com> Gerrit-HasComments: Yes