public class CsvTableSink extends Object implements BatchTableSink<Row>, AppendStreamTableSink<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,
FileSystem.WriteMode writeMode)
A simple
TableSink to emit data as CSV files. |
CsvTableSink(String path,
String fieldDelim,
int numFiles,
FileSystem.WriteMode writeMode,
String[] fieldNames,
DataType[] fieldTypes)
A simple
TableSink to emit data as CSV files. |
Modifier and Type | Method and Description |
---|---|
TableSink<Row> |
configure(String[] fieldNames,
TypeInformation<?>[] fieldTypes)
Returns a copy of this
TableSink configured with the field names and types of the
table to emit. |
DataStreamSink<?> |
consumeDataStream(DataStream<Row> dataStream)
Consumes the DataStream and return the sink transformation
DataStreamSink . |
void |
emitDataSet(DataSet<Row> dataSet)
Emits the DataSet.
|
void |
emitDataStream(DataStream<Row> dataStream)
Emits the DataStream.
|
DataType |
getConsumedDataType()
Returns the data type consumed by this
TableSink . |
TableSchema |
getTableSchema()
Returns the schema of the consumed table.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFieldNames, getFieldTypes, getOutputType
public CsvTableSink(String path, String fieldDelim, int numFiles, FileSystem.WriteMode writeMode, String[] fieldNames, 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, 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 void emitDataSet(DataSet<Row> dataSet)
BatchTableSink
emitDataSet
in interface BatchTableSink<Row>
public DataStreamSink<?> consumeDataStream(DataStream<Row> dataStream)
StreamTableSink
DataStreamSink
.
The returned DataStreamSink
will be used to set resources for the sink operator.consumeDataStream
in interface StreamTableSink<Row>
public void emitDataStream(DataStream<Row> dataStream)
StreamTableSink
emitDataStream
in interface StreamTableSink<Row>
public TableSink<Row> configure(String[] fieldNames, TypeInformation<?>[] fieldTypes)
TableSink
TableSink
configured with the field names and types of the
table to emit.public DataType getConsumedDataType()
TableSink
TableSink
.getConsumedDataType
in interface TableSink<Row>
TableSink
.public TableSchema getTableSchema()
TableSink
getTableSchema
in interface TableSink<Row>
TableSchema
of the consumed table.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.