Lewis
Lewis

Reputation: 432

'Index for header <column name> is 1 but CSVRecord only has one values' error in Nifi

I'm splitting a CSV file into two based on their row values (whether they have error values or not, and cells containing 999 are considered errors). but when I run it through the QueryRecord processor, I get the error below. What could be the possible fix for this?

Sample CSV

GradeNm ,CattleBreedNm ,CattleGenderNm ,Price
C++     ,beef_cattle   ,Female         ,10094
C++     ,hanwoo        ,Female         ,12001
C++     ,beef_cattle   ,Male           ,12704
B++     ,milk_cow      ,Female         ,16942
999     ,hanwoo        ,Male           ,error999
A++     ,hanwoo        ,Male           ,17952
D++     ,hanwoo        ,Female         ,8940
999     ,hanwoo        ,Female         ,error999
999     ,beef_cattle   ,Male           ,error999
999     ,hanwoo        ,Male           ,error999

enter image description here

enter image description here

enter image description here

Upvotes: 1

Views: 2080

Answers (1)

Lewis
Lewis

Reputation: 432

This was due to my CSV file containing a line with less than 4 fields. I mistakenly added a blank line at the end of the CSV file and that was causing the problem

Upvotes: 3

Related Questions