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.
Item | Description |
---|---|
Table type | Result table |
Running mode | Batch mode and streaming mode |
Data format | N/A |
Metric | N/A |
API type | SQL API |
Data update or deletion in a result table | Supported |
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
Parameter | Description | Data type | Required | Default value | Remarks |
---|---|---|---|---|---|
connector | The type of the result table. | STRING | Yes | No default value | Set the value to print. |
logger | Specifies whether to display the data result in the console. | BOOLEAN | No | false | Valid values:
|
print-identifier | The identifier of the data result. | STRING | No | No default value | The log information is retrieved by using the identifier of the data result. |
sink.parallelism | The parallelism of the result table. | INT | No | A value that is the same as the upstream parallelism | N/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;