[
https://issues.apache.org/jira/browse/NIFI-3910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16012712#comment-16012712
]
ASF GitHub Bot commented on NIFI-3910:
--------------------------------------
Github user jfrazee commented on a diff in the pull request:
https://github.com/apache/nifi/pull/1807#discussion_r116796084
--- Diff:
nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/csv/CSVRecordReader.java
---
@@ -68,17 +68,19 @@ public Record nextRecord() throws IOException,
MalformedRecordException {
final Map<String, Object> rowValues = new
HashMap<>(schema.getFieldCount());
for (final RecordField recordField : schema.getFields()) {
- String rawValue =
csvRecord.get(recordField.getFieldName());
- if (rawValue == null) {
+ String rawValue = null;
+ final String fieldName = recordField.getFieldName();
+ if (csvRecord.isSet(fieldName)) {
+ rawValue = csvRecord.get(fieldName);
+ } else {
for (final String alias : recordField.getAliases()) {
- rawValue = csvRecord.get(alias);
- if (rawValue != null) {
+ if (csvRecord.isSet(fieldName)) {
--- End diff --
@markap14 Shouldn't you be checking isSet(alias)? Since this is in the
else, presumably isSet(fieldName) is still false?
> ConvertRecord or CSVReader not handling input data which has more columns
> than the schema properly
> --------------------------------------------------------------------------------------------------
>
> Key: NIFI-3910
> URL: https://issues.apache.org/jira/browse/NIFI-3910
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Affects Versions: 1.2.0
> Reporter: Joseph Witt
> Assignee: Mark Payne
> Fix For: 1.3.0
>
>
> Example when reading a single line CSV where the number of actual data
> columns exceeded what the schema expected we just failed/rolledback the
> session.
> We should route to failure in that case and/or ideally try to parse it up to
> the max known columns.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)