Hi,
Reg. 1:
Scala case classes are supported in the Scala specific version of the
DataStream API. If you are using case classes in the Java API you will
get the INFO below because the Java API uses pure reflection extraction
for analyzing POJOs.
The Scala API tries to analyze Scala classes first, if this is not
possible it will fallback to Java reflection extraction. So in your case
the INFO should not be present because it is a pure Scala case class. Is
it used within a non-case class?
Reg 2:
Most classes can be serialized by Flink. That's why the log lines are
just of type INFO because they might affect the performance slightly. If
you are performance sensitive. I would recommend primtive types, arrays
and case classes.
Regards,
Timo
On 15.01.20 03:47, Utopia wrote:
Hi folks,
I have two questions about types in Flink when using Scala:
*1. scala case class: *
This my case class define:
case class SensorReading(var id: String , var timestamp: Long, var
temperature: Double)
In documentation, Scala case class is supported:
`Scala /case classes/(including Scala tuples): null fields not supported`
But the log info shows:
10:26:08,489 INFO org.apache.flink.api.java.typeutils.TypeExtractor -
class io.github.streamingwithflink.util.SensorReading is missing a
default constructor so it cannot be used as a POJO type and must be
processed as GenericType. Please read the Flink documentation on "Data
Types & Serialization" for details of the effect on performance.
*2. scala list*
*
*
This my case class define:
case class SensorReading(var id:String ,var timestamp: Long,var temperature:
Double,var list:List[String] =List[String]())
log shows:
No fields were detected for class scala.collection.immutable.List so it
cannot be used as a POJO type and must be processed as GenericType.
Please read the Flink documentation on "Data Types & Serialization" for
details of the effect on performance.
Does it means that scala list can be serialize that I can ignore this
info if I don’t care the performance.
Should I use Java array list instead of scala list or create a custom
serializer for SensorReading case class?
Thanks!
Best regards
Utopia