diff --git a/be/src/service/fe-support.cc b/be/src/service/fe-support.cc index a0e1c18b9..c4b1a032e 100644 --- a/be/src/service/fe-support.cc +++ b/be/src/service/fe-support.cc @@ -116,7 +116,9 @@ Java_com_cloudera_impala_service_FeSupport_NativeEvalConstExprs( for (int i = 0; i < expr_ctxs.size(); ++i) { Status open_status = expr_ctxs[i]->Open(&state); if (!open_status.ok()) { - expr_ctxs[i]->Close(&state); + for (int j = i; j < expr_ctxs.size(); ++j) { + expr_ctxs[j]->Close(&state); + } (env)->ThrowNew(JniUtil::internal_exc_class(), open_status.GetDetail().c_str()); return result_bytes; } @@ -126,7 +128,9 @@ Java_com_cloudera_impala_service_FeSupport_NativeEvalConstExprs( // and throw an exception accordingly Status getvalue_status = expr_ctxs[i]->root()->GetFnContextError(expr_ctxs[i]); if (!getvalue_status.ok()) { - expr_ctxs[i]->Close(&state); + for (int j = i; j < expr_ctxs.size(); ++j) { + expr_ctxs[j]->Close(&state); + } (env)->ThrowNew(JniUtil::internal_exc_class(), getvalue_status.GetDetail().c_str()); return result_bytes; } diff --git a/testdata/workloads/functional-query/queries/QueryTest/hdfs-partitions.test b/testdata/workloads/functional-query/queries/QueryTest/hdfs-partitions.test index 11d257649..f38287b27 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/hdfs-partitions.test +++ b/testdata/workloads/functional-query/queries/QueryTest/hdfs-partitions.test @@ -173,3 +173,10 @@ select count(*) from alltypesagg where day not in (1, 2, null) ---- TYPES BIGINT ==== +---- QUERY +# IMPALA-2514: DCHECK on ExprContext::Close() +select int_col from functional.alltypes +where year=date_part('yyyyMMMdd hh:mm:ss', current_timestamp()); +---- CATCH +InternalException: invalid extract field: yyyyMMMdd hh:mm:ss +====