Print
This documentation is for an out-of-date version of Apache Flink. We recommend you use the latest stable version.

Print SQL Connector #

Sink

The Print connector allows for writing every row to the standard output or standard error stream.

It is designed for:

  • Easy test for streaming job.
  • Very useful in production debugging.

Four possible format options:

Print Condition1 Condition2
PRINT_IDENTIFIER:taskId> output
PRINT_IDENTIFIER provided parallelism > 1
PRINT_IDENTIFIER> output
PRINT_IDENTIFIER provided parallelism == 1
taskId> output
no PRINT_IDENTIFIER provided parallelism > 1
output
no PRINT_IDENTIFIER provided parallelism == 1

The output string format is “$row_kind(f0,f1,f2…)”, row_kind is the short string of RowKind, example is: “+I(1,1)”.

The Print connector is built-in.

Attention Print sinks print records in runtime tasks, you need to observe the task log.

How to create a Print table #

CREATE TABLE print_table (
  f0 INT,
  f1 INT,
  f2 STRING,
  f3 DOUBLE
) WITH (
  'connector' = 'print'
);

Alternatively, it may be based on an existing schema using the LIKE Clause.

CREATE TABLE print_table WITH ('connector' = 'print')
LIKE source_table (EXCLUDING ALL)

Connector Options #

Option Required Default Type Description
connector
required (none) String Specify what connector to use, here should be 'print'.
print-identifier
optional (none) String Message that identify print and is prefixed to the output of the value.
standard-error
optional false Boolean True, if the format should print to standard error instead of standard out.
sink.parallelism
optional (none) Integer Defines the parallelism of the Print sink operator. By default, the parallelism is determined by the framework using the same parallelism of the upstream chained operator.