[NO ISSUE][HYR][RT] Handle calls to close() properly in hash join
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
Hash join build activity assumes that upon calling close()
the join state must have been allocated in open() and
therefore, it will directly call "close build" using the join
state. However, if the build activity throws an exception
in open(), then it could happen that the join state has
not been initialized. Calling close() on the build activity
will lead to a NPE since it will use the join state directly.
This patch checks if the join state has been initialized. If
so, it will close the build as usual.
Change-Id: I41fff7deed5e56818bfefb4d36b8018a9f512cbb
Reviewed-on: https://asterix-gerrit.ics.uci.edu/3375
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/OptimizedHybridHashJoinOperatorDescriptor.java b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/OptimizedHybridHashJoinOperatorDescriptor.java
index 403c492..81d08b2 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/OptimizedHybridHashJoinOperatorDescriptor.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/OptimizedHybridHashJoinOperatorDescriptor.java
@@ -315,13 +315,15 @@
@Override
public void close() throws HyracksDataException {
- state.hybridHJ.closeBuild();
- if (isFailed) {
- state.hybridHJ.clearBuildTempFiles();
- } else {
- ctx.setStateObject(state);
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("OptimizedHybridHashJoin closed its build phase");
+ if (state.hybridHJ != null) {
+ state.hybridHJ.closeBuild();
+ if (isFailed) {
+ state.hybridHJ.clearBuildTempFiles();
+ } else {
+ ctx.setStateObject(state);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("OptimizedHybridHashJoin closed its build phase");
+ }
}
}
}