You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Minsu Kim (JIRA)" <ji...@apache.org> on 2019/01/16 04:30:00 UTC
[jira] [Created] (NIFI-5958) JsonTreeReader can't resolve
ChoiceDataType properly
Minsu Kim created NIFI-5958:
-------------------------------
Summary: 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
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
(v7.6.3#76005)