Skip to content
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

support source watermark for flink sql windows #12191

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

swapna267
Copy link

Iceberg Source to support Source Watermark, so it can be used in Flink WINDOW functions. https://github.com/apache/flink/blob/release-1.18/flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/source/abilities/SupportsSourceWatermark.java enables Flink to rely on the watermark strategy provided by the ScanTableSource itself.

CREATE TABLE table_wm (
      eventTS AS CAST(t1 AS TIMESTAMP(3)),
      WATERMARK FOR eventTS AS SOURCE_WATERMARK()
) WITH (
  'watermark-column'='t1'
) LIKE iceberg_catalog.db.table;

Reference:
#10219
#9346

Previous discussion in PR, #12116 . Split into separate PR for easy review.

@github-actions github-actions bot added the flink label Feb 7, 2025
@@ -86,7 +86,7 @@ protected void dropDatabase(String database, boolean ifExists) {
sql("DROP DATABASE %s %s", ifExists ? "IF EXISTS" : "", database);
}

protected static String toWithClause(Map<String, String> props) {
public static String toWithClause(Map<String, String> props) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change? Did this become a utility method which is shared between tests? Can we find a better place for it then?

.isInstanceOf(NullPointerException.class)
.hasMessage("watermark-column needs to be configured to use source watermark.");
} finally {
SqlHelpers.sql(getStreamingTableEnv(), "DROP TABLE IF EXISTS %s", flinkTable);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this try finally? Can we just do a cleanup in an after method? That would make the tests easier to read

}

@NotNull
private static Map<String, String> getConnectorOptions() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do the PRs in a different order (first merging the optionless part), could we get rid of this method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants