-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[FLINK-37724] Adds AsyncTableFunction as a fully supported UDF type #26567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<table class="configuration table table-bordered"> | ||
<thead> | ||
<tr> | ||
<th class="text-left" style="width: 20%">Key</th> | ||
<th class="text-left" style="width: 15%">Default</th> | ||
<th class="text-left" style="width: 10%">Type</th> | ||
<th class="text-left" style="width: 55%">Description</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td><h5>sink.committer.retries</h5></td> | ||
<td style="word-wrap: break-word;">10</td> | ||
<td>Integer</td> | ||
<td>The number of retries a Flink application attempts for committable operations (such as transactions) on retriable errors, as specified by the sink connector, before Flink fails and potentially restarts.</td> | ||
</tr> | ||
</tbody> | ||
</table> |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -34,6 +34,7 @@ | |||||
import java.util.ArrayList; | ||||||
import java.util.Collections; | ||||||
import java.util.List; | ||||||
import java.util.Optional; | ||||||
|
||||||
import static org.apache.flink.shaded.asm9.org.objectweb.asm.Type.getConstructorDescriptor; | ||||||
import static org.apache.flink.shaded.asm9.org.objectweb.asm.Type.getMethodDescriptor; | ||||||
|
@@ -373,4 +374,28 @@ public static void validateLambdaType(Class<?> baseClass, Type t) { | |||||
+ "Otherwise the type has to be specified explicitly using type information."); | ||||||
} | ||||||
} | ||||||
|
||||||
/** | ||||||
* Will return true if the type of the given generic class type. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
* | ||||||
* @param clazz The generic class to check against | ||||||
* @param type The type to be checked | ||||||
*/ | ||||||
public static boolean isGenericOfClass(Class<?> clazz, Type type) { | ||||||
Optional<ParameterizedType> parameterized = getParameterizedType(type); | ||||||
return clazz.equals(type) | ||||||
|| parameterized.isPresent() && clazz.equals(parameterized.get().getRawType()); | ||||||
} | ||||||
|
||||||
/** | ||||||
* Returns an optional of a ParameterizedType, if that's what the type is. | ||||||
* | ||||||
* @param type The type to check | ||||||
* @return optional which is present if the type is a ParameterizedType | ||||||
*/ | ||||||
public static Optional<ParameterizedType> getParameterizedType(Type type) { | ||||||
Comment on lines
+384
to
+396
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add unit test for these two function? |
||||||
return Optional.of(type) | ||||||
.filter(p -> p instanceof ParameterizedType) | ||||||
.map(ParameterizedType.class::cast); | ||||||
} | ||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -409,7 +409,7 @@ public class ExecutionConfigOptions { | |
.intType() | ||
.defaultValue(10) | ||
.withDescription( | ||
"The max number of async i/o operation that the async lookup join can trigger."); | ||
"The max number of async i/o operation that the async scalar function can trigger."); | ||
|
||
@Documentation.TableOption(execMode = Documentation.ExecMode.STREAMING) | ||
public static final ConfigOption<Duration> TABLE_EXEC_ASYNC_SCALAR_TIMEOUT = | ||
|
@@ -443,6 +443,49 @@ public class ExecutionConfigOptions { | |
"The max number of async retry attempts to make before task " | ||
+ "execution is failed."); | ||
|
||
// ------------------------------------------------------------------------ | ||
// Async Table Function | ||
// ------------------------------------------------------------------------ | ||
@Documentation.TableOption(execMode = Documentation.ExecMode.STREAMING) | ||
public static final ConfigOption<Integer> TABLE_EXEC_ASYNC_TABLE_BUFFER_CAPACITY = | ||
key("table.exec.async-table.buffer-capacity") | ||
.intType() | ||
.defaultValue(10) | ||
.withDescription( | ||
"The max number of async i/o operations that the async table function can trigger."); | ||
|
||
@Documentation.TableOption(execMode = Documentation.ExecMode.STREAMING) | ||
public static final ConfigOption<Duration> TABLE_EXEC_ASYNC_TABLE_TIMEOUT = | ||
key("table.exec.async-table.timeout") | ||
.durationType() | ||
.defaultValue(Duration.ofMinutes(3)) | ||
.withDescription( | ||
"The async timeout for the asynchronous operation to complete."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the timeout for each retry or total timeout for all retries? I suppose it's for each retry |
||
|
||
@Documentation.TableOption(execMode = Documentation.ExecMode.STREAMING) | ||
public static final ConfigOption<RetryStrategy> TABLE_EXEC_ASYNC_TABLE_RETRY_STRATEGY = | ||
key("table.exec.async-table.retry-strategy") | ||
.enumType(RetryStrategy.class) | ||
.defaultValue(RetryStrategy.FIXED_DELAY) | ||
.withDescription( | ||
"Restart strategy which will be used, FIXED_DELAY by default."); | ||
|
||
@Documentation.TableOption(execMode = Documentation.ExecMode.STREAMING) | ||
public static final ConfigOption<Duration> TABLE_EXEC_ASYNC_TABLE_RETRY_DELAY = | ||
key("table.exec.async-table.retry-delay") | ||
.durationType() | ||
.defaultValue(Duration.ofMillis(100)) | ||
.withDescription("The delay to wait before trying again."); | ||
|
||
@Documentation.TableOption(execMode = Documentation.ExecMode.STREAMING) | ||
public static final ConfigOption<Integer> TABLE_EXEC_ASYNC_TABLE_MAX_ATTEMPTS = | ||
key("table.exec.async-table.max-attempts") | ||
.intType() | ||
.defaultValue(3) | ||
.withDescription( | ||
"The max number of async retry attempts to make before task " | ||
+ "execution is failed."); | ||
|
||
// ------------------------------------------------------------------------ | ||
// MiniBatch Options | ||
// ------------------------------------------------------------------------ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unrelated the async table function?