flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vinh June <hoangthevinh....@gmail.com>
Subject Re: CSV input with unknown # of fields and Custom output format
Date Wed, 04 Feb 2015 10:52:51 GMT
Thanks,
I just tried and it works with scala also. 

Small notice for anyone who mights interested is that the constructor of
TypeSerializerInputFormat needs a TypeSerializer, not a TypeInformation. So
this would work in Scala:
----------------------------------------
[SCALA]
val readback = env
  .readFile[MyClass](
    new
TypeSerializerInputFormat[MyClass](dataSet.getType.createSerializer()),
    dataPath)
----------------------------------------

If you want to separate write and readFile into different object (as in
above code, I used env.readFile ), then in this case, dataSet is not
available, we'll need to create serializer from class definition as below
----------------------------------------
[SCALA]
val readback = env
  .readFile[MyClass](
    new
TypeSerializerInputFormat[MyClass](createTypeInformation[MyClass].createSerializer()),
    dataPath)
----------------------------------------

Again, thank you @Stephan



--
View this message in context: http://apache-flink-incubator-user-mailing-list-archive.2336050.n4.nabble.com/CSV-input-with-unknown-of-fields-and-Custom-output-format-tp670p675.html
Sent from the Apache Flink (Incubator) User Mailing List archive. mailing list archive at
Nabble.com.

Mime
View raw message