This topic describes how to use the Print connector.

Background information

The Print connector is used for debugging and can be used to receive and print a specific number of input records. If you want to view the intermediate results or the output of an SQL statement, you can add 'connector'='print' to the WITH clause of the SQL statement and click Run. Then, you can view the output in JobManager logs.

The Print connector can be used to check whether the messages sent to other result tables meet the expectations.

The following table describes the capabilities supported by the Print connector.
ItemDescription
Table typeResult table
Running modeBatch mode and streaming mode
Data formatN/A
MetricN/A
API typeSQL API
Data update or deletion in a result tableSupported

Prerequisites

  • If you want to view the output of a Print result table, you must make sure that the log level is set to INFO.
  • A maximum of 2,000 log entries can be displayed in Taskmanager.out. If you want to check for dirty data or specific data, we recommend that you specify conditions in the WHERE clause to perform the print operation. The print operation ensures that the required data can be checked even if the number of data records that can be displayed is limited.

Limits

Only Realtime Compute for Apache Flink that uses Ververica Runtime (VVR) 2.1.5 or later supports the Print connector.

Syntax

CREATE TABLE print_table (
  a INT,
  b varchar
) WITH (
  'connector'='print',
  'logger'='true'
);
You can also create a Print table by using the LIKE clause based on an existing table schema. Sample statement:
CREATE TABLE print_table WITH ('connector' = 'print')
LIKE table_source (EXCLUDING ALL)

Parameters in the WITH clause

ParameterDescriptionData typeRequiredDefault valueRemarks
connectorThe type of the result table. STRINGYesNo default valueSet the value to print.
loggerSpecifies whether to display the data result in the console. BOOLEANNofalseValid values:
  • false: The data result is not displayed in the console. This is the default value.
  • true: The data result is displayed in the console.
print-identifierThe identifier of the data result. STRINGNoNo default valueThe log information is retrieved by using the identifier of the data result.
sink.parallelismThe parallelism of the result table. INTNoA value that is the same as the upstream parallelismN/A.

Sample code

CREATE TABLE table_source(
  name VARCHAR,
  score BIGINT
) WITH (
  ...
);

CREATE TABLE print_sink(
  name VARCHAR,
  score BIGINT
) WITH (
  'connector' = 'print'
);

INSERT INTO print_sink SELECT * from table_source;