-
Notifications
You must be signed in to change notification settings - Fork 13.9k
[FLINK-39764] Support dynamic table options in Table API #28266
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 |
|---|---|---|
|
|
@@ -43,6 +43,7 @@ | |
| import java.io.Serializable; | ||
| import java.util.Arrays; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Optional; | ||
|
|
||
| /** | ||
|
|
@@ -1080,6 +1081,34 @@ void createTemporarySystemFunction( | |
| */ | ||
| Table from(String path); | ||
|
|
||
| /** | ||
| * Reads a registered table and applies dynamic options, returning the corresponding {@link | ||
| * Table}. | ||
| * | ||
| * <p>Dynamic options override the table's static options defined at creation time (DDL). | ||
| * This is the Table API equivalent of SQL's {@code OPTIONS} hint: | ||
| * | ||
| * <pre>{@code | ||
| * // Table API (this method) | ||
| * Table tab = tableEnv.from("kafka_table1", Map.of("scan.startup.mode", "earliest-offset")); | ||
| * | ||
| * // Equivalent SQL | ||
| * // SELECT * FROM kafka_table1 /*+ OPTIONS('scan.startup.mode'='earliest-offset') * / | ||
| * }</pre> | ||
| * | ||
| * <p>The configuration option {@code table.dynamic-table-options.enabled} must be set to | ||
| * {@code true} (the default) for dynamic options to take effect. | ||
| * | ||
| * <p>Note: Dynamic options cannot be applied to views. | ||
| * | ||
| * @param path The path of a table API object to scan. | ||
| * @param dynamicOptions A map of option key-value pairs to override on the table. | ||
| * @return The {@link Table} object describing the pipeline for further transformations. | ||
| * @throws ValidationException if the table is not found, is a view, or dynamic options are | ||
|
Contributor
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. what about materialized tables?
Contributor
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. what happens if the options specified are not valid - I assume this would be a validation error as well. |
||
| * disabled. | ||
| */ | ||
| Table from(String path, Map<String, String> dynamicOptions); | ||
|
Contributor
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. are all dynamic options Strings? |
||
|
|
||
| /** | ||
| * Returns a {@link Table} backed by the given {@link TableDescriptor descriptor}. | ||
| * | ||
|
|
||
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.
We should update the documentation to describe this and why the user would want to do this with examples.