public class CsvTableSink extends Object implements BatchTableSink<org.apache.flink.types.Row>, AppendStreamTableSink<org.apache.flink.types.Row>
TableSink to emit data as CSV files.| Modifier and Type | Class and Description |
|---|---|
static class |
CsvTableSink.CsvFormatter
Formats a Row into a String with fields separated by the field delimiter.
|
| Constructor and Description |
|---|
CsvTableSink(String path)
A simple
TableSink to emit data as CSV files using comma as field delimiter, with
default parallelism and write mode. |
CsvTableSink(String path,
String fieldDelim)
A simple
TableSink to emit data as CSV files, with default parallelism and write
mode. |
CsvTableSink(String path,
String fieldDelim,
int numFiles,
org.apache.flink.core.fs.FileSystem.WriteMode writeMode)
A simple
TableSink to emit data as CSV files. |
CsvTableSink(String path,
String fieldDelim,
int numFiles,
org.apache.flink.core.fs.FileSystem.WriteMode writeMode,
String[] fieldNames,
org.apache.flink.table.types.DataType[] fieldTypes)
A simple
TableSink to emit data as CSV files. |
| Modifier and Type | Method and Description |
|---|---|
org.apache.flink.table.sinks.TableSink<org.apache.flink.types.Row> |
configure(String[] fieldNames,
org.apache.flink.api.common.typeinfo.TypeInformation<?>[] fieldTypes) |
org.apache.flink.api.java.operators.DataSink<?> |
consumeDataSet(org.apache.flink.api.java.DataSet<org.apache.flink.types.Row> dataSet)
Consumes the DataSet and return the
DataSink. |
org.apache.flink.streaming.api.datastream.DataStreamSink<?> |
consumeDataStream(org.apache.flink.streaming.api.datastream.DataStream<org.apache.flink.types.Row> dataStream)
Consumes the DataStream and return the sink transformation
DataStreamSink. |
org.apache.flink.table.types.DataType |
getConsumedDataType() |
org.apache.flink.table.api.TableSchema |
getTableSchema() |
public CsvTableSink(String path, String fieldDelim, int numFiles, org.apache.flink.core.fs.FileSystem.WriteMode writeMode, String[] fieldNames, org.apache.flink.table.types.DataType[] fieldTypes)
TableSink to emit data as CSV files.path - The output path to write the Table to.fieldDelim - The field delimiternumFiles - The number of files to write towriteMode - The write mode to specify whether existing files are overwritten or not.fieldNames - The field names of the table to emit.fieldTypes - The field types of the table to emit.public CsvTableSink(String path, String fieldDelim, int numFiles, org.apache.flink.core.fs.FileSystem.WriteMode writeMode)
TableSink to emit data as CSV files.path - The output path to write the Table to.fieldDelim - The field delimiternumFiles - The number of files to write towriteMode - The write mode to specify whether existing files are overwritten or not.public CsvTableSink(String path)
TableSink to emit data as CSV files using comma as field delimiter, with
default parallelism and write mode.path - The output path to write the Table to.public org.apache.flink.api.java.operators.DataSink<?> consumeDataSet(org.apache.flink.api.java.DataSet<org.apache.flink.types.Row> dataSet)
BatchTableSinkDataSink. The returned DataSink will be
used to generate Plan.consumeDataSet in interface BatchTableSink<org.apache.flink.types.Row>public org.apache.flink.streaming.api.datastream.DataStreamSink<?> consumeDataStream(org.apache.flink.streaming.api.datastream.DataStream<org.apache.flink.types.Row> dataStream)
StreamTableSinkDataStreamSink. The
returned DataStreamSink will be used to set resources for the sink operator.consumeDataStream in interface StreamTableSink<org.apache.flink.types.Row>public org.apache.flink.table.sinks.TableSink<org.apache.flink.types.Row> configure(String[] fieldNames, org.apache.flink.api.common.typeinfo.TypeInformation<?>[] fieldTypes)
configure in interface org.apache.flink.table.sinks.TableSink<org.apache.flink.types.Row>public org.apache.flink.table.types.DataType getConsumedDataType()
getConsumedDataType in interface org.apache.flink.table.sinks.TableSink<org.apache.flink.types.Row>public org.apache.flink.table.api.TableSchema getTableSchema()
getTableSchema in interface org.apache.flink.table.sinks.TableSink<org.apache.flink.types.Row>Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.