Search in sources :

Example 1 with TupleCsvInputFormat

use of org.apache.flink.api.java.io.TupleCsvInputFormat in project flink by apache.

the class PythonPlanBinder method createCsvSource.

@SuppressWarnings("unchecked")
private void createCsvSource(PythonOperationInfo info) throws IOException {
    if (!(info.types instanceof TupleTypeInfo)) {
        throw new RuntimeException("The output type of a csv source has to be a tuple. The derived type is " + info);
    }
    Path path = new Path(info.path);
    String lineD = info.lineDelimiter;
    String fieldD = info.fieldDelimiter;
    TupleTypeInfo<?> types = (TupleTypeInfo) info.types;
    sets.put(info.setID, env.createInput(new TupleCsvInputFormat(path, lineD, fieldD, types), info.types).setParallelism(getParallelism(info)).name("CsvSource").map(new SerializerMap<>()).setParallelism(getParallelism(info)).name("CsvSourcePostStep"));
}
Also used : Path(org.apache.flink.core.fs.Path) TupleCsvInputFormat(org.apache.flink.api.java.io.TupleCsvInputFormat) SerializerMap(org.apache.flink.python.api.functions.util.SerializerMap) TupleTypeInfo(org.apache.flink.api.java.typeutils.TupleTypeInfo)

Aggregations

TupleCsvInputFormat (org.apache.flink.api.java.io.TupleCsvInputFormat)1 TupleTypeInfo (org.apache.flink.api.java.typeutils.TupleTypeInfo)1 Path (org.apache.flink.core.fs.Path)1 SerializerMap (org.apache.flink.python.api.functions.util.SerializerMap)1