Skip to content

Commit 1fee154

Browse files
committed
EXAUDFClient: Optimize code ordering to reduce performance degradation
of #117
1 parent ea43de0 commit 1fee154

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

exaudfclient/base/javacontainer/ExaIteratorImpl.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,7 @@ public void emit(Object... values) throws ExaIterationException, ExaDataTypeExce
7070
if (insideRun && singleOutput)
7171
throw new ExaIterationException("emit() function is not allowed in scalar context");
7272

73-
if(values == null){
74-
if(exaMetadata.getOutputColumnCount()==1){
75-
resultHandler.setNull(0);
76-
}else{
77-
String errorText = "emit() takes exactly " + exaMetadata.getOutputColumnCount();
78-
errorText += (exaMetadata.getOutputColumnCount() > 1) ? " arguments" : " argument";
79-
errorText += " (" + 1 + " given)";
80-
throw new ExaIterationException(errorText);
81-
}
82-
}else{
73+
if(values != null){
8374
if (values.length != exaMetadata.getOutputColumnCount()) {
8475
String errorText = "emit() takes exactly " + exaMetadata.getOutputColumnCount();
8576
errorText += (exaMetadata.getOutputColumnCount() > 1) ? " arguments" : " argument";
@@ -202,6 +193,15 @@ else if (values[i] instanceof Timestamp) {
202193
throw new ExaIterationException(exMsg);
203194
}
204195
}
196+
}else{
197+
if(exaMetadata.getOutputColumnCount()==1){
198+
resultHandler.setNull(0);
199+
}else{
200+
String errorText = "emit() takes exactly " + exaMetadata.getOutputColumnCount();
201+
errorText += (exaMetadata.getOutputColumnCount() > 1) ? " arguments" : " argument";
202+
errorText += " (" + 1 + " given)";
203+
throw new ExaIterationException(errorText);
204+
}
205205
}
206206

207207
boolean next = resultHandler.next();

0 commit comments

Comments
 (0)