Skip to content

Commit 4ed6e0e

Browse files
committed
[FLINK-35652][table] Expose taskinfo in FunctionContext
1 parent ea74da0 commit 4ed6e0e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/FunctionContext.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package org.apache.flink.table.functions;
2020

2121
import org.apache.flink.annotation.PublicEvolving;
22+
import org.apache.flink.api.common.TaskInfo;
2223
import org.apache.flink.api.common.externalresource.ExternalResourceInfo;
2324
import org.apache.flink.api.common.functions.OpenContext;
2425
import org.apache.flink.api.common.functions.RuntimeContext;
@@ -80,6 +81,20 @@ public FunctionContext(RuntimeContext context) {
8081
this(context, null, null);
8182
}
8283

84+
/**
85+
* Get the {@link TaskInfo} for this parallel subtask.
86+
*
87+
* @return task info for this parallel subtask.
88+
*/
89+
public TaskInfo getTaskInfo() {
90+
if (context == null) {
91+
throw new TableException(
92+
"Calls to FunctionContext.getTaskInfo are not available "
93+
+ "at the current location.");
94+
}
95+
return context.getTaskInfo();
96+
}
97+
8398
/**
8499
* Returns the metric group for this parallel subtask.
85100
*

0 commit comments

Comments
 (0)