Skip to content

Conversation

@twalthr
Copy link
Contributor

@twalthr twalthr commented Sep 17, 2020

What is the purpose of the change

Example for aggregating and ranking data using Flink SQL on updating (but bounded) streams.

This PR depends on #13291.

Brief change log

The example shows how to declare a table using SQL DDL for reading insert-only data and handling
updating data. It should give a first impression about Flink SQL as a changelog processor. The example
uses some streaming operations that produce a stream of updates. See the other examples for pure CDC
processing and more complex operations.

Verifying this change

This change added tests and can be verified as follows: UpdatingTopCityExample

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): yes
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

danny0405 and others added 2 commits September 17, 2020 16:01
… wrong result

The batch mode rank only supports RANK function, so we only rewrite the
stream mode query.
@twalthr twalthr changed the title Flink 19188 [FLINK-19188][examples-table] Add a new streaming SQL example Sep 17, 2020
@flinkbot
Copy link
Collaborator

flinkbot commented Sep 17, 2020

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit 4ccc07b (Fri May 28 06:58:32 UTC 2021)

Warnings:

  • 1 pom.xml files were touched: Check for build and licensing issues.
  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.

Details
The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@flinkbot
Copy link
Collaborator

flinkbot commented Sep 17, 2020

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run travis re-run the last Travis build
  • @flinkbot run azure re-run the last Azure build

Copy link
Contributor

@dawidwys dawidwys left a comment

Choose a reason for hiding this comment

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

Nice work!

+1 to merge, (after #13291 is merged, ofc ;) )

import java.util.List;

/**
* Example for aggregating and ranking data using Flink SQL on updating (but bounded) streams.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Is the (but bounded) note necessary or important for the example? Just wondering if it helps users understand the use case/example or introduces unnecessary distraction/additional concept to understand.

);

// since all cluster operations of the Table API are executed asynchronously,
// we need wait until the insertion has been completed,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// we need wait until the insertion has been completed,
// we need to wait until the insertion has been completed,

@twalthr
Copy link
Contributor Author

twalthr commented Nov 24, 2020

@rmetzger Do we consider examples as features? This PR is laying around for quite some time and was blocked by a bug that will be fixed soon. The Table/SQL API lacks new updated examples.

@rmetzger
Copy link
Contributor

I think examples are comparable to documentation. I still would be careful if an example changes a lot of dependencies.

In this case I'm fine with merging it.

@twalthr twalthr closed this in e4286e7 Nov 24, 2020
final RowKind kind = row.getKind();
switch (kind) {
case INSERT:
case UPDATE_BEFORE:
Copy link
Contributor

Choose a reason for hiding this comment

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

Here should be UPDATE_AFTER

row.setKind(RowKind.INSERT); // for equality
materializedUpdates.add(row);
break;
case UPDATE_AFTER:
Copy link
Contributor

Choose a reason for hiding this comment

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

Here should be UPDATE_BEFORE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants