dawidwys commented on a change in pull request #8357:
URL: https://github.com/apache/flink/pull/8357#discussion_r459579778
##########
File path:
flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java
##########
@@ -1837,8 +1837,8 @@ private boolean isValidPojoField(Field f, Class<?> clazz,
ArrayList<Type> typeHi
if (parameterizedType != null) {
getTypeHierarchy(typeHierarchy, parameterizedType,
Object.class);
}
- // create a type hierarchy, if the incoming only contains the
most bottom one or none.
- else if (typeHierarchy.size() <= 1) {
+ // create a type hierarchy, for fields types extraction
Review comment:
I would use this opportunity to simplify the code a bit. Actually the
`clazz` and ` parameterizedType` are very tightly coupled and one originiates
from the other. I think we could simplify the method slightly if we removed the
`parameterizedType` parameter. Than the beginning of this method could like
this:
```
protected <OUT, IN1, IN2> TypeInformation<OUT> analyzePojo(
Type type,
List<Type> typeHierarchy,
TypeInformation<IN1> in1Type,
TypeInformation<IN2> in2Type) {
Class<OUT> clazz = typeToClass(type);
if (!Modifier.isPublic(clazz.getModifiers())) {
LOG.info("Class " + clazz.getName() + " is not public
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.");
return new GenericTypeInfo<OUT>(clazz);
}
// add the hierarchy of the POJO
getTypeHierarchy(typeHierarchy, type, Object.class);
...
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]