Skip to content

Commit 9fb66af

Browse files
authored
Avoid potential deadlock in TableFunctionLeafOperator
1 parent 4f9e75f commit 9fb66af

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.apache.iotdb.udf.api.relational.table.TableFunctionProcessorProvider;
2727
import org.apache.iotdb.udf.api.relational.table.processor.TableFunctionLeafProcessor;
2828

29+
import com.google.common.util.concurrent.ListenableFuture;
2930
import org.apache.tsfile.block.column.ColumnBuilder;
3031
import org.apache.tsfile.enums.TSDataType;
3132
import org.apache.tsfile.read.common.block.TsBlock;
@@ -44,17 +45,26 @@ public class TableFunctionLeafOperator implements ProcessOperator {
4445
private final TsBlockBuilder blockBuilder;
4546

4647
private final TableFunctionLeafProcessor processor;
48+
private volatile boolean init = false;
4749

4850
public TableFunctionLeafOperator(
4951
OperatorContext operatorContext,
5052
TableFunctionProcessorProvider processorProvider,
5153
List<TSDataType> outputDataTypes) {
5254
this.operatorContext = operatorContext;
5355
this.processor = processorProvider.getSplitProcessor();
54-
this.processor.beforeStart();
5556
this.blockBuilder = new TsBlockBuilder(outputDataTypes);
5657
}
5758

59+
@Override
60+
public ListenableFuture<?> isBlocked() {
61+
if (!init) {
62+
init = true;
63+
processor.beforeStart();
64+
}
65+
return NOT_BLOCKED;
66+
}
67+
5868
@Override
5969
public OperatorContext getOperatorContext() {
6070
return this.operatorContext;

0 commit comments

Comments
 (0)