You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Chesnay Schepler (Jira)" <ji...@apache.org> on 2022/10/07 10:46:00 UTC

[jira] [Comment Edited] (FLINK-29534) @TypeInfo on field requires field type to be valid Pojo

    [ https://issues.apache.org/jira/browse/FLINK-29534?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17614016#comment-17614016 ] 

Chesnay Schepler edited comment on FLINK-29534 at 10/7/22 10:45 AM:
--------------------------------------------------------------------

??It also doesn't look like like there's a way to register org.apache.flink.api.common.typeutils.TypeSerializer globally on 3rd-party types??

Yes, this was removed at some point.



was (Author: zentol):
>  It also doesn't look like like there's a way to register org.apache.flink.api.common.typeutils.TypeSerializer globally on 3rd-party types

Yes, this was removed at some point.


> @TypeInfo on field requires field type to be valid Pojo 
> --------------------------------------------------------
>
>                 Key: FLINK-29534
>                 URL: https://issues.apache.org/jira/browse/FLINK-29534
>             Project: Flink
>          Issue Type: Bug
>          Components: API / Type Serialization System
>    Affects Versions: 1.14.0, 1.15.0
>            Reporter: Exidex
>            Priority: Major
>
> The ability to place @TypeInfo on field was added in [https://github.com/apache/flink/pull/8344] . But it seams like the fact that it requires field to be a valid POJO was overlooked. In my case I was trying to add custom serializer for Jackson's ObjectNode (wrapped in List but not sure if this is relevant https://issues.apache.org/jira/browse/FLINK-26470) which is not a valid POJO, and this requirement seams to defeat the whole purpose of such feature. It also doesn't look like like there's a way to register {{org.apache.flink.api.common.typeutils.TypeSerializer}} globally on 3rd-party types
> code snippet from TypeExtractor:
> {code:java}
> Type fieldType = field.getGenericType();
> if (!isValidPojoField(field, clazz, typeHierarchy) && clazz != Row.class) {
>     LOG.info(
>             "Class "
>                     + clazz
>                     + " cannot be used as a POJO type because not all fields are valid POJO fields, "
>                     + "and must be processed as GenericType. {}",
>             GENERIC_TYPE_DOC_HINT);
>     return null;
> }
> try {
>     final TypeInformation<?> typeInfo;
>     List<Type> fieldTypeHierarchy = new ArrayList<>(typeHierarchy);
>     TypeInfoFactory factory = getTypeInfoFactory(field);
>     if (factory != null) {{code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)