[
https://issues.apache.org/jira/browse/FLINK-19622?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
宋洪亮 updated FLINK-19622:
------------------------
Description:
Hello, when I use flinksql version 1.11 to analyze data in avro format in
Kafka, I used the Map type. For this type, my definition is
MAP<VARCHAR,VARCHAR>, but the analysis is because the value in the map is
empty. Null pointer exception
The source code is attached below (AvroRowDataDeserializationSchema)
{code:java}
private static DeserializationRuntimeConverter createMapConverter(LogicalType
type) {
final DeserializationRuntimeConverter keyConverter = createConverter(
DataTypes.STRING().getLogicalType());
final DeserializationRuntimeConverter valueConverter = createConverter(
extractValueTypeToAvroMap(type));
return avroObject -> {
final Map<?, ?> map = (Map<?, ?>) avroObject;
Map<Object, Object> result = new HashMap<>();
for (Map.Entry<?, ?> entry : map.entrySet()) {
Object key = keyConverter.convert(entry.getKey());
Object value = valueConverter.convert(entry.getValue());
result.put(key, value);
}
return new GenericMapData(result);
};
}
{code}
was:
hello,我在使用flinksql
1.11版本针对kafka中avro格式的数据解析时,使用到了Map类型,针对此类型我的定义是MAP<VARCHAR,VARCHAR>,但是在解析是由于map中的value为空我碰到了空指针异常
Environment: (was: 下面附上源码 AvroRowDataDeserializationSchema
{code:java}
私有 静态DeserializationRuntimeConverter createMapConverter(LogicalType类型){
最终DeserializationRuntimeConverter keyConverter = createConverter(
DataTypes.STRING()。getLogicalType());
最后的DeserializationRuntimeConverter valueConverter = createConverter(
extractValueTypeToAvroMap(type));
返回avroObject-> {
final Map <?,?> map =(Map <?,?>)avroObject;
Map < Object,Object > result = new HashMap <>();
对于(Map.Entry <?,?> entry:map.entrySet()){
对象键= keyConverter.convert(entry.getKey());
对象值= valueConverter.convert(entry.getValue());
result.put(key,value);
}
返回 新的GenericMapData(result);
};
}
{code})
Summary: Flinksql version 1.11 is for the null pointer exception of the
Map type value value in the avro format (was: flinksql
1.11版本针对avro格式中Map类型value值的空指针异常)
> Flinksql version 1.11 is for the null pointer exception of the Map type value
> value in the avro format
> ------------------------------------------------------------------------------------------------------
>
> Key: FLINK-19622
> URL: https://issues.apache.org/jira/browse/FLINK-19622
> Project: Flink
> Issue Type: Bug
> Components: Formats (JSON, Avro, Parquet, ORC, SequenceFile)
> Affects Versions: 1.11.1
> Reporter: 宋洪亮
> Priority: Critical
>
> Hello, when I use flinksql version 1.11 to analyze data in avro format in
> Kafka, I used the Map type. For this type, my definition is
> MAP<VARCHAR,VARCHAR>, but the analysis is because the value in the map is
> empty. Null pointer exception
> The source code is attached below (AvroRowDataDeserializationSchema)
> {code:java}
> private static DeserializationRuntimeConverter createMapConverter(LogicalType
> type) {
> final DeserializationRuntimeConverter keyConverter = createConverter(
> DataTypes.STRING().getLogicalType());
> final DeserializationRuntimeConverter valueConverter = createConverter(
> extractValueTypeToAvroMap(type));
> return avroObject -> {
> final Map<?, ?> map = (Map<?, ?>) avroObject;
> Map<Object, Object> result = new HashMap<>();
> for (Map.Entry<?, ?> entry : map.entrySet()) {
> Object key = keyConverter.convert(entry.getKey());
> Object value = valueConverter.convert(entry.getValue());
> result.put(key, value);
> }
> return new GenericMapData(result);
> };
> }
> {code}
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)