flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Federico D'Ambrosio" <federico.dambro...@smartlab.ws>
Subject Dot notation not working for accessing case classes nested fields
Date Thu, 14 Sep 2017 13:51:23 GMT

I have the following case classes:

case class Event(instantValues: InstantValues)
case class InstantValues(speed: Int, altitude: Int, time: DateTime)

in a DataStream[Event] I'd like to perform a maxBy operation on the field
time of instantValue for each event and according to the docs here
would be possible to use the dot notation such the following:

val events = stream

positionToMaxBy - In case of a POJO, Scala case class, or Tuple type, the
name of the public) field on which to perform the aggregation.
Additionally, a dot can be used to drill down into nested objects, as
in "field1.fieldxy"
. Furthermore "*" can be specified in case of a basic type (which is
considered as having only one field).

Still, I'm getting the following error:

Fields 'instantValues.time' are not valid for 'package.Event(instantValues:
package.InstantValues(speed: Integer, altitude: Integer, time:

whereas if, for instance, use only "instantValues" (while implementing its
compareTo method) the aggregation works as usual.

Any idea as to why this isn't working? Am I doing something wrong?

Thanks a lot,

View raw message