flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aljoscha <...@git.apache.org>
Subject [GitHub] incubator-flink pull request: [scala] Change ScalaAggregateOperato...
Date Thu, 11 Dec 2014 17:05:05 GMT
Github user aljoscha commented on a diff in the pull request:

    --- Diff: flink-scala/src/main/java/org/apache/flink/api/scala/operators/ScalaAggregateOperator.java
    @@ -164,18 +160,8 @@ public ScalaAggregateOperator(Grouping<IN> input, Aggregations
function, int fie
    -		TypeSerializer<IN> serializer = getInputType().createSerializer();
    -		TypeSerializerFactory<IN> serializerFactory;
    -		if (serializer.isStateful()) {
    -			serializerFactory = new RuntimeStatefulSerializerFactory<IN>(
    -					serializer, getInputType().getTypeClass());
    -		} else {
    -			serializerFactory = new RuntimeStatelessSerializerFactory<IN>(
    -					serializer, getInputType().getTypeClass());
    -		}
    -		RichGroupReduceFunction<IN, IN> function = new AggregatingUdf(serializerFactory,
aggFunctions, fields);
    +		RichGroupReduceFunction<IN, IN> function = new AggregatingUdf((TupleSerializerBase)
getInputType().createSerializer(), aggFunctions, fields);
    --- End diff --
    We could maybe. If we enhanced TypeSerializer to have a method createInstance(...) that
can create an instance with the given field values. This is only possible for a small subset
of the types that we support: The Java Tuple Types, since we control their constructors. And
Scala Case Classes, since we assume that the fields are exactly the constructor arguments,
as is customary for Case Classes.
    We would then need to add createInstance(...) methods to all other TypeSerializers that
throw an Exception telling the user that instance creation with field values is not supported.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message