[
https://issues.apache.org/jira/browse/NIFI-5958?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pierre Villard resolved NIFI-5958.
----------------------------------
Resolution: Feedback Received
Apache NiFi 1.x is no longer maintained and no new release is planned on the
1.x release line. Marking as resolved as part of a cleanup operation. Please
open a new one with an updated description if this is still relevant for NiFi
2.x.
> JsonTreeReader can't resolve ChoiceDataType properly
> ----------------------------------------------------
>
> Key: NIFI-5958
> URL: https://issues.apache.org/jira/browse/NIFI-5958
> Project: Apache NiFi
> Issue Type: Bug
> Components: Core Framework
> Affects Versions: 1.9.0
> Reporter: Minsu Kim
> Priority: Major
>
> When reading json, JsonTreeReader doesn't seem to work properly.
> A field is either string or map. so I define schema as choiceType, but it
> always parsed as string
>
> Details:
> * dataType in RecordSchema: CHOICE[STRING, MAP[STRING]]
> * json to resolve: \{"key": "value"}
> * expected result: HashMap
> * actual result: char[] ("MapRecord[\{key=value}]")
>
> I found this code in AbstractJsonRowRecordReader
>
> {code:java}
> } else if (dataType != null && RecordFieldType.CHOICE ==
> dataType.getFieldType()) {
> final ChoiceDataType choiceDataType = (ChoiceDataType) dataType;
> for (final DataType possibleDataType :
> choiceDataType.getPossibleSubTypes()) {
> if (possibleDataType.getFieldType() != RecordFieldType.RECORD) {
> continue;
> }{code}
>
> Reader handles only when possible type is record, ignoring map type.
> Please let me know whether it's intention or problem
>
> Thanks
--
This message was sent by Atlassian Jira
(v8.20.10#820010)