Dennis Jaheruddin
Dennis Jaheruddin

Reputation: 21563

Flink SQL create something from nothing

Earlier I asked if Flink could create something from nothing and the answer is yes. Now I am looking more into the capabilities of Flink SQL specifically.

In SQL this type of challenge is sometimes easy (e.g. SELECT 1 works in regular engines such as MySQL) but also it sometimes is impossible, for example Apache Pig cannot create something from nothing.

I am not sure about Flink SQL, the idea is of course that with the ability to create something from nothing, it eliminates any hard dependencies on other solutions when you want to run a quick test or build a portable example.

For sake of simplicity: Assume I want to generate at least 1 message per second, and don't mind what is inside.


My first thoughts:

Other than windowing I do not see anything in Flink SQL that has the concept of time, so outside that I suspect it will not be possible.

What am I Not looking for:

Upvotes: 1

Views: 854

Answers (2)

David Anderson
David Anderson

Reputation: 43499

Even better than the datagen connector is flink-faker, which has been used is many of the examples in the Flink SQL Cookbook. I think you'll find these examples especially interesting.

Flink SQL has powerful support for working with both event time and system time, including watermarking. For example, Flink SQL uses watermarks to determine which records can be expired from Flink state when handling streaming event time windows and interval joins.

For some additional Flink SQL operations that leverage time, see time versioned tables, pattern detection, temporal joins, and time-based lookup joins.

Upvotes: 4

Frank Wilson
Frank Wilson

Reputation: 3250

You might find the “datagen” connector useful for this.

https://ci.apache.org/projects/flink/flink-docs-release-1.12/dev/table/connectors/datagen.html

For example:

CREATE TABLE Orders (
order_number BIGINT,
price        DECIMAL(32,2),
buyer        ROW<first_name STRING, last_name STRING>,
order_time   TIMESTAMP(3)
) WITH (
  'connector' = 'datagen'
)

Upvotes: 1

Related Questions