Skip to content

Commit 1165497

Browse files
authored
Print thread stack for udf execution error
1 parent 593520a commit 1165497

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ public FragmentInstanceInfo execDataQueryFragmentInstance(
205205
} else if (t instanceof UDFTypeMismatchException) {
206206
stateMachine.failed(new SemanticException(t.getMessage()));
207207
} else if (t instanceof UDFException) {
208+
logger.warn("Exception happened when executing UDTF: ", t);
208209
stateMachine.failed(
209210
new IoTDBRuntimeException(
210211
t.getMessage(), TSStatusCode.EXECUTE_UDF_ERROR.getStatusCode(), true));

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/process/function/TableFunctionLeafOperator.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import org.apache.tsfile.read.common.block.TsBlock;
3333
import org.apache.tsfile.read.common.block.TsBlockBuilder;
3434
import org.apache.tsfile.read.common.block.column.RunLengthEncodedColumn;
35+
import org.slf4j.Logger;
36+
import org.slf4j.LoggerFactory;
3537

3638
import java.util.Arrays;
3739
import java.util.List;
@@ -40,6 +42,7 @@
4042

4143
// only one input source is supported now
4244
public class TableFunctionLeafOperator implements ProcessOperator {
45+
private static final Logger LOGGER = LoggerFactory.getLogger(TableFunctionLeafOperator.class);
4346

4447
private final OperatorContext operatorContext;
4548
private final TsBlockBuilder blockBuilder;
@@ -76,6 +79,7 @@ public TsBlock next() throws Exception {
7679
try {
7780
processor.process(columnBuilders);
7881
} catch (Exception e) {
82+
LOGGER.warn("Exception happened when executing UDTF: ", e);
7983
throw new IoTDBRuntimeException(
8084
e.getMessage(), TSStatusCode.EXECUTE_UDF_ERROR.getStatusCode(), true);
8185
}
@@ -103,6 +107,7 @@ public void close() throws Exception {
103107
try {
104108
processor.beforeDestroy();
105109
} catch (Exception e) {
110+
LOGGER.warn("Exception happened when executing UDTF: ", e);
106111
throw new IoTDBRuntimeException(
107112
e.getMessage(), TSStatusCode.EXECUTE_UDF_ERROR.getStatusCode(), true);
108113
}

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ public static TSStatus onQueryException(Exception e, String operation, TSStatusC
120120
|| status.getCode() == TSStatusCode.NO_AVAILABLE_REPLICA.getStatusCode()
121121
|| status.getCode() == TSStatusCode.CANNOT_FETCH_FI_STATE.getStatusCode()
122122
|| status.getCode() == TSStatusCode.QUERY_EXECUTION_MEMORY_NOT_ENOUGH.getStatusCode()
123+
|| status.getCode() == TSStatusCode.EXECUTE_UDF_ERROR.getStatusCode()
123124
|| status.getCode() == TSStatusCode.QUERY_TIMEOUT.getStatusCode()) {
124125
LOGGER.info(message);
125126
} else {

iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/exception/IoTDBRuntimeException.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ public IoTDBRuntimeException(String message, int errorCode, boolean isUserExcept
4040
this.isUserException = isUserException;
4141
}
4242

43+
public IoTDBRuntimeException(
44+
String message, int errorCode, Throwable cause, boolean isUserException) {
45+
super(message, cause);
46+
this.errorCode = errorCode;
47+
this.isUserException = isUserException;
48+
}
49+
4350
public IoTDBRuntimeException(String message, Throwable cause, int errorCode) {
4451
super(message, cause);
4552
this.errorCode = errorCode;

0 commit comments

Comments
 (0)