Ali Alsuliman has uploaded this change for review. ( 
https://asterix-gerrit.ics.uci.edu/3375


Change subject: [NO ISSUE][HYR][RT] Handle calls to close() properly in hash 
join
......................................................................

[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
---
M 
hyracks-fullstack/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/join/OptimizedHybridHashJoinOperatorDescriptor.java
1 file changed, 9 insertions(+), 7 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/75/3375/1

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");
+                            }
                         }
                     }
                 }

--
To view, visit https://asterix-gerrit.ics.uci.edu/3375
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I41fff7deed5e56818bfefb4d36b8018a9f512cbb
Gerrit-Change-Number: 3375
Gerrit-PatchSet: 1
Gerrit-Owner: Ali Alsuliman <ali.al.solai...@gmail.com>

Reply via email to