Re: [PR] NIFI-12593 - ValidateCSV - get all constraint violations for an invalid line [nifi]

2024-01-16 Thread via GitHub


exceptionfactory closed pull request #8229: NIFI-12593 - ValidateCSV - get all 
constraint violations for an invalid line
URL: https://github.com/apache/nifi/pull/8229


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12593 - ValidateCSV - get all constraint violations for an invalid line [nifi]

2024-01-15 Thread via GitHub


pvillard31 commented on PR #8229:
URL: https://github.com/apache/nifi/pull/8229#issuecomment-1893191565

   I've pushed changes to address the comments of the review. Thanks @dan-s1 
@exceptionfactory.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12593 - ValidateCSV - get all constraint violations for an invalid line [nifi]

2024-01-15 Thread via GitHub


dan-s1 commented on code in PR #8229:
URL: https://github.com/apache/nifi/pull/8229#discussion_r1452651455


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java:
##
@@ -174,6 +175,19 @@ public class ValidateCsv extends AbstractProcessor {
 .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
 .build();
 
+public static final PropertyDescriptor GET_ALL_VIOLATIONS = new 
PropertyDescriptor.Builder()
+.name("validate-csv-violations")
+.displayName("Get all violations")
+.description("If true, the validation.error.message attribute 
would contain the list of all the violations"
++ " for the first invalid line. Note that setting this 
property to true would slightly decrease"
++ " the performances as all columns would be validated. If 
false, a line is invalid as soon as a"
++ " column is found violating the specified constraint and 
only this violation for the first invalid"
++ " line will be indicated in the validation.error.message 
attribute.")
+.required(true)
+.allowableValues("true", "false")
+.defaultValue("false")
+.build();

Review Comment:
   @pvillard31 I am fine with include also. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12593 - ValidateCSV - get all constraint violations for an invalid line [nifi]

2024-01-15 Thread via GitHub


exceptionfactory commented on code in PR #8229:
URL: https://github.com/apache/nifi/pull/8229#discussion_r1452650933


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java:
##
@@ -174,6 +175,19 @@ public class ValidateCsv extends AbstractProcessor {
 .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
 .build();
 
+public static final PropertyDescriptor GET_ALL_VIOLATIONS = new 
PropertyDescriptor.Builder()
+.name("validate-csv-violations")
+.displayName("Get all violations")
+.description("If true, the validation.error.message attribute 
would contain the list of all the violations"
++ " for the first invalid line. Note that setting this 
property to true would slightly decrease"
++ " the performances as all columns would be validated. If 
false, a line is invalid as soon as a"
++ " column is found violating the specified constraint and 
only this violation for the first invalid"
++ " line will be indicated in the validation.error.message 
attribute.")
+.required(true)
+.allowableValues("true", "false")
+.defaultValue("false")
+.build();

Review Comment:
   `Include All Violations` sounds sufficient, or `Report All Errors` if you 
prefer.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12593 - ValidateCSV - get all constraint violations for an invalid line [nifi]

2024-01-15 Thread via GitHub


exceptionfactory commented on code in PR #8229:
URL: https://github.com/apache/nifi/pull/8229#discussion_r1452650933


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java:
##
@@ -174,6 +175,19 @@ public class ValidateCsv extends AbstractProcessor {
 .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
 .build();
 
+public static final PropertyDescriptor GET_ALL_VIOLATIONS = new 
PropertyDescriptor.Builder()
+.name("validate-csv-violations")
+.displayName("Get all violations")
+.description("If true, the validation.error.message attribute 
would contain the list of all the violations"
++ " for the first invalid line. Note that setting this 
property to true would slightly decrease"
++ " the performances as all columns would be validated. If 
false, a line is invalid as soon as a"
++ " column is found violating the specified constraint and 
only this violation for the first invalid"
++ " line will be indicated in the validation.error.message 
attribute.")
+.required(true)
+.allowableValues("true", "false")
+.defaultValue("false")
+.build();

Review Comment:
   `Include All Violations` sounds sufficient.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12593 - ValidateCSV - get all constraint violations for an invalid line [nifi]

2024-01-15 Thread via GitHub


dan-s1 commented on code in PR #8229:
URL: https://github.com/apache/nifi/pull/8229#discussion_r1452648947


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java:
##
@@ -619,18 +632,83 @@ public NifiCsvListReader(Reader reader, CsvPreference 
preferences) {
 super(reader, preferences);
 }
 
-@Override
-public List read(CellProcessor... processors) throws 
IOException {
+public List read(boolean getAllViolations, CellProcessor... 
processors) throws IOException {
 if( processors == null ) {
 throw new NullPointerException("Processors should not be 
null");
 }
 if( readRow() ) {
-super.executeProcessors(new 
ArrayList(getColumns().size()), processors);
+executeProcessors(new ArrayList(getColumns().size()), 
processors, getAllViolations);
 return new ArrayList(getColumns());
 }
 return null; // EOF
 }
 
+protected List executeProcessors(List 
processedColumns, CellProcessor[] processors, boolean getAllViolations) {
+this.executeCellProcessors(processedColumns, getColumns(), 
processors, getLineNumber(), getRowNumber(), getAllViolations);
+return processedColumns;
+}
+
+private void executeCellProcessors(final List destination, 
final List source,
+final CellProcessor[] processors, final int lineNo, final int 
rowNo, boolean getAllViolations) {
+
+if( destination == null ) {
+throw new NullPointerException("destination should not be 
null");
+} else if( source == null ) {
+throw new NullPointerException("source should not be 
null");
+} else if( processors == null ) {
+throw new NullPointerException("processors should not be 
null");
+}

Review Comment:
   I understand but it seems redundant as I pointed out. Even if it would be 
necessary to throw an exception, I believe `IllegalArgumentException`  would be 
more appropriate.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12593 - ValidateCSV - get all constraint violations for an invalid line [nifi]

2024-01-15 Thread via GitHub


dan-s1 commented on code in PR #8229:
URL: https://github.com/apache/nifi/pull/8229#discussion_r1452648947


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java:
##
@@ -619,18 +632,83 @@ public NifiCsvListReader(Reader reader, CsvPreference 
preferences) {
 super(reader, preferences);
 }
 
-@Override
-public List read(CellProcessor... processors) throws 
IOException {
+public List read(boolean getAllViolations, CellProcessor... 
processors) throws IOException {
 if( processors == null ) {
 throw new NullPointerException("Processors should not be 
null");
 }
 if( readRow() ) {
-super.executeProcessors(new 
ArrayList(getColumns().size()), processors);
+executeProcessors(new ArrayList(getColumns().size()), 
processors, getAllViolations);
 return new ArrayList(getColumns());
 }
 return null; // EOF
 }
 
+protected List executeProcessors(List 
processedColumns, CellProcessor[] processors, boolean getAllViolations) {
+this.executeCellProcessors(processedColumns, getColumns(), 
processors, getLineNumber(), getRowNumber(), getAllViolations);
+return processedColumns;
+}
+
+private void executeCellProcessors(final List destination, 
final List source,
+final CellProcessor[] processors, final int lineNo, final int 
rowNo, boolean getAllViolations) {
+
+if( destination == null ) {
+throw new NullPointerException("destination should not be 
null");
+} else if( source == null ) {
+throw new NullPointerException("source should not be 
null");
+} else if( processors == null ) {
+throw new NullPointerException("processors should not be 
null");
+}

Review Comment:
   I understand but it seems redundant as I pointed out. Even it would be 
necessary to throw an exception, I believe `IllegalArgumentException`  would be 
more appropriate.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12593 - ValidateCSV - get all constraint violations for an invalid line [nifi]

2024-01-15 Thread via GitHub


pvillard31 commented on code in PR #8229:
URL: https://github.com/apache/nifi/pull/8229#discussion_r1452639503


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java:
##
@@ -174,6 +175,19 @@ public class ValidateCsv extends AbstractProcessor {
 .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
 .build();
 
+public static final PropertyDescriptor GET_ALL_VIOLATIONS = new 
PropertyDescriptor.Builder()
+.name("validate-csv-violations")
+.displayName("Get all violations")
+.description("If true, the validation.error.message attribute 
would contain the list of all the violations"
++ " for the first invalid line. Note that setting this 
property to true would slightly decrease"
++ " the performances as all columns would be validated. If 
false, a line is invalid as soon as a"
++ " column is found violating the specified constraint and 
only this violation for the first invalid"
++ " line will be indicated in the validation.error.message 
attribute.")
+.required(true)
+.allowableValues("true", "false")
+.defaultValue("false")
+.build();

Review Comment:
   I like the ``include`` suggestion. Using a strategy seems a bit overkill to 
me. If there is a consensus in favor of using a strategy, I'll make the change.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12593 - ValidateCSV - get all constraint violations for an invalid line [nifi]

2024-01-15 Thread via GitHub


exceptionfactory commented on code in PR #8229:
URL: https://github.com/apache/nifi/pull/8229#discussion_r1452630053


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java:
##
@@ -174,6 +175,19 @@ public class ValidateCsv extends AbstractProcessor {
 .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
 .build();
 
+public static final PropertyDescriptor GET_ALL_VIOLATIONS = new 
PropertyDescriptor.Builder()
+.name("validate-csv-violations")
+.displayName("Get all violations")
+.description("If true, the validation.error.message attribute 
would contain the list of all the violations"
++ " for the first invalid line. Note that setting this 
property to true would slightly decrease"
++ " the performances as all columns would be validated. If 
false, a line is invalid as soon as a"
++ " column is found violating the specified constraint and 
only this violation for the first invalid"
++ " line will be indicated in the validation.error.message 
attribute.")
+.required(true)
+.allowableValues("true", "false")
+.defaultValue("false")
+.build();

Review Comment:
   I agree that `Get` is not optimal, but `All Violations` seems unclear. What 
about `Include All Violations`? Perhaps for better clarity, even though there 
are only two options, what about `Error Reporting Strategy` that is either 
`ALL` or `FIRST`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12593 - ValidateCSV - get all constraint violations for an invalid line [nifi]

2024-01-15 Thread via GitHub


pvillard31 commented on code in PR #8229:
URL: https://github.com/apache/nifi/pull/8229#discussion_r1452629738


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java:
##
@@ -174,6 +175,19 @@ public class ValidateCsv extends AbstractProcessor {
 .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
 .build();
 
+public static final PropertyDescriptor GET_ALL_VIOLATIONS = new 
PropertyDescriptor.Builder()
+.name("validate-csv-violations")
+.displayName("Get all violations")
+.description("If true, the validation.error.message attribute 
would contain the list of all the violations"
++ " for the first invalid line. Note that setting this 
property to true would slightly decrease"
++ " the performances as all columns would be validated. If 
false, a line is invalid as soon as a"
++ " column is found violating the specified constraint and 
only this violation for the first invalid"
++ " line will be indicated in the validation.error.message 
attribute.")
+.required(true)
+.allowableValues("true", "false")
+.defaultValue("false")
+.build();

Review Comment:
   I've not looked at all of the codebase but usually a True/False property's 
description is starting with a verb. I'm fine using another work like "check" 
but I do think a verb should be used.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12593 - ValidateCSV - get all constraint violations for an invalid line [nifi]

2024-01-15 Thread via GitHub


exceptionfactory commented on code in PR #8229:
URL: https://github.com/apache/nifi/pull/8229#discussion_r1452629026


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java:
##
@@ -619,18 +632,83 @@ public NifiCsvListReader(Reader reader, CsvPreference 
preferences) {
 super(reader, preferences);
 }
 
-@Override
-public List read(CellProcessor... processors) throws 
IOException {
+public List read(boolean getAllViolations, CellProcessor... 
processors) throws IOException {
 if( processors == null ) {
 throw new NullPointerException("Processors should not be 
null");
 }
 if( readRow() ) {
-super.executeProcessors(new 
ArrayList(getColumns().size()), processors);
+executeProcessors(new ArrayList(getColumns().size()), 
processors, getAllViolations);
 return new ArrayList(getColumns());

Review Comment:
   IntellIJ flags this as unnecessary, so it seems like a worthwhile cleanup 
opportunity.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12593 - ValidateCSV - get all constraint violations for an invalid line [nifi]

2024-01-15 Thread via GitHub


pvillard31 commented on code in PR #8229:
URL: https://github.com/apache/nifi/pull/8229#discussion_r1452628163


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java:
##
@@ -619,18 +632,83 @@ public NifiCsvListReader(Reader reader, CsvPreference 
preferences) {
 super(reader, preferences);
 }
 
-@Override
-public List read(CellProcessor... processors) throws 
IOException {
+public List read(boolean getAllViolations, CellProcessor... 
processors) throws IOException {
 if( processors == null ) {
 throw new NullPointerException("Processors should not be 
null");
 }
 if( readRow() ) {
-super.executeProcessors(new 
ArrayList(getColumns().size()), processors);
+executeProcessors(new ArrayList(getColumns().size()), 
processors, getAllViolations);
 return new ArrayList(getColumns());
 }
 return null; // EOF
 }
 
+protected List executeProcessors(List 
processedColumns, CellProcessor[] processors, boolean getAllViolations) {
+this.executeCellProcessors(processedColumns, getColumns(), 
processors, getLineNumber(), getRowNumber(), getAllViolations);
+return processedColumns;
+}
+
+private void executeCellProcessors(final List destination, 
final List source,
+final CellProcessor[] processors, final int lineNo, final int 
rowNo, boolean getAllViolations) {
+
+if( destination == null ) {
+throw new NullPointerException("destination should not be 
null");
+} else if( source == null ) {
+throw new NullPointerException("source should not be 
null");
+} else if( processors == null ) {
+throw new NullPointerException("processors should not be 
null");
+}

Review Comment:
   This code is copied from the Utils class of the underlying library we're 
using and I didn't want to change its code. That's the reason it is this way. I 
don't mind changing it though.



##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java:
##
@@ -619,18 +632,83 @@ public NifiCsvListReader(Reader reader, CsvPreference 
preferences) {
 super(reader, preferences);
 }
 
-@Override
-public List read(CellProcessor... processors) throws 
IOException {
+public List read(boolean getAllViolations, CellProcessor... 
processors) throws IOException {
 if( processors == null ) {
 throw new NullPointerException("Processors should not be 
null");
 }
 if( readRow() ) {
-super.executeProcessors(new 
ArrayList(getColumns().size()), processors);
+executeProcessors(new ArrayList(getColumns().size()), 
processors, getAllViolations);
 return new ArrayList(getColumns());
 }
 return null; // EOF
 }
 
+protected List executeProcessors(List 
processedColumns, CellProcessor[] processors, boolean getAllViolations) {
+this.executeCellProcessors(processedColumns, getColumns(), 
processors, getLineNumber(), getRowNumber(), getAllViolations);
+return processedColumns;
+}
+
+private void executeCellProcessors(final List destination, 
final List source,
+final CellProcessor[] processors, final int lineNo, final int 
rowNo, boolean getAllViolations) {
+
+if( destination == null ) {
+throw new NullPointerException("destination should not be 
null");
+} else if( source == null ) {
+throw new NullPointerException("source should not be 
null");
+} else if( processors == null ) {
+throw new NullPointerException("processors should not be 
null");
+}
+
+// the context used when cell processors report exceptions
+final CsvContext context = new CsvContext(lineNo, rowNo, 1);
+context.setRowSource(new ArrayList(source));

Review Comment:
   While I agree specifying the type is not required, isn't it making the code 
more readable?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12593 - ValidateCSV - get all constraint violations for an invalid line [nifi]

2024-01-15 Thread via GitHub


pvillard31 commented on code in PR #8229:
URL: https://github.com/apache/nifi/pull/8229#discussion_r1452627532


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java:
##
@@ -619,18 +632,83 @@ public NifiCsvListReader(Reader reader, CsvPreference 
preferences) {
 super(reader, preferences);
 }
 
-@Override
-public List read(CellProcessor... processors) throws 
IOException {
+public List read(boolean getAllViolations, CellProcessor... 
processors) throws IOException {
 if( processors == null ) {
 throw new NullPointerException("Processors should not be 
null");
 }
 if( readRow() ) {
-super.executeProcessors(new 
ArrayList(getColumns().size()), processors);
+executeProcessors(new ArrayList(getColumns().size()), 
processors, getAllViolations);
 return new ArrayList(getColumns());

Review Comment:
   While I agree specifying the type is not required, isn't it making the code 
more readable?



##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java:
##
@@ -619,18 +632,83 @@ public NifiCsvListReader(Reader reader, CsvPreference 
preferences) {
 super(reader, preferences);
 }
 
-@Override
-public List read(CellProcessor... processors) throws 
IOException {
+public List read(boolean getAllViolations, CellProcessor... 
processors) throws IOException {
 if( processors == null ) {
 throw new NullPointerException("Processors should not be 
null");
 }
 if( readRow() ) {
-super.executeProcessors(new 
ArrayList(getColumns().size()), processors);
+executeProcessors(new ArrayList(getColumns().size()), 
processors, getAllViolations);
 return new ArrayList(getColumns());
 }
 return null; // EOF
 }
 
+protected List executeProcessors(List 
processedColumns, CellProcessor[] processors, boolean getAllViolations) {
+this.executeCellProcessors(processedColumns, getColumns(), 
processors, getLineNumber(), getRowNumber(), getAllViolations);
+return processedColumns;
+}
+
+private void executeCellProcessors(final List destination, 
final List source,
+final CellProcessor[] processors, final int lineNo, final int 
rowNo, boolean getAllViolations) {
+
+if( destination == null ) {
+throw new NullPointerException("destination should not be 
null");
+} else if( source == null ) {
+throw new NullPointerException("source should not be 
null");
+} else if( processors == null ) {
+throw new NullPointerException("processors should not be 
null");
+}
+
+// the context used when cell processors report exceptions
+final CsvContext context = new CsvContext(lineNo, rowNo, 1);
+context.setRowSource(new ArrayList(source));
+
+if( source.size() != processors.length ) {
+throw new SuperCsvException(String.format(
+"The number of columns to be processed (%d) must match 
the number of CellProcessors (%d): check that the number"
++ " of CellProcessors you have defined matches the 
expected number of columns being read/written",
+source.size(), processors.length), context);
+}
+
+destination.clear();
+
+List errors = new ArrayList();

Review Comment:
   While I agree specifying the type is not required, isn't it making the code 
more readable?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12593 - ValidateCSV - get all constraint violations for an invalid line [nifi]

2024-01-12 Thread via GitHub


dan-s1 commented on code in PR #8229:
URL: https://github.com/apache/nifi/pull/8229#discussion_r1450508701


##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java:
##
@@ -619,18 +632,83 @@ public NifiCsvListReader(Reader reader, CsvPreference 
preferences) {
 super(reader, preferences);
 }
 
-@Override
-public List read(CellProcessor... processors) throws 
IOException {
+public List read(boolean getAllViolations, CellProcessor... 
processors) throws IOException {
 if( processors == null ) {
 throw new NullPointerException("Processors should not be 
null");
 }
 if( readRow() ) {
-super.executeProcessors(new 
ArrayList(getColumns().size()), processors);
+executeProcessors(new ArrayList(getColumns().size()), 
processors, getAllViolations);
 return new ArrayList(getColumns());

Review Comment:
   ```suggestion
   executeProcessors(new ArrayList<>(getColumns().size()), 
processors, getAllViolations);
   return new ArrayList<>(getColumns());
   ```



##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java:
##
@@ -619,18 +632,83 @@ public NifiCsvListReader(Reader reader, CsvPreference 
preferences) {
 super(reader, preferences);
 }
 
-@Override
-public List read(CellProcessor... processors) throws 
IOException {
+public List read(boolean getAllViolations, CellProcessor... 
processors) throws IOException {
 if( processors == null ) {
 throw new NullPointerException("Processors should not be 
null");
 }
 if( readRow() ) {
-super.executeProcessors(new 
ArrayList(getColumns().size()), processors);
+executeProcessors(new ArrayList(getColumns().size()), 
processors, getAllViolations);

Review Comment:
   See earlier comment
   ```suggestion
   executeProcessors(new 
ArrayList(getColumns().size()), processors, allViolations);
   ```



##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java:
##
@@ -619,18 +632,83 @@ public NifiCsvListReader(Reader reader, CsvPreference 
preferences) {
 super(reader, preferences);
 }
 
-@Override
-public List read(CellProcessor... processors) throws 
IOException {
+public List read(boolean getAllViolations, CellProcessor... 
processors) throws IOException {
 if( processors == null ) {
 throw new NullPointerException("Processors should not be 
null");
 }
 if( readRow() ) {
-super.executeProcessors(new 
ArrayList(getColumns().size()), processors);
+executeProcessors(new ArrayList(getColumns().size()), 
processors, getAllViolations);
 return new ArrayList(getColumns());
 }
 return null; // EOF
 }
 
+protected List executeProcessors(List 
processedColumns, CellProcessor[] processors, boolean getAllViolations) {
+this.executeCellProcessors(processedColumns, getColumns(), 
processors, getLineNumber(), getRowNumber(), getAllViolations);
+return processedColumns;

Review Comment:
   See earlier comment
   ```suggestion
   protected List executeProcessors(List 
processedColumns, CellProcessor[] processors, boolean allViolations) {
   this.executeCellProcessors(processedColumns, getColumns(), 
processors, getLineNumber(), getRowNumber(), allViolations);
   return processedColumns;
   ```



##
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java:
##
@@ -619,18 +632,83 @@ public NifiCsvListReader(Reader reader, CsvPreference 
preferences) {
 super(reader, preferences);
 }
 
-@Override
-public List read(CellProcessor... processors) throws 
IOException {
+public List read(boolean getAllViolations, CellProcessor... 
processors) throws IOException {
 if( processors == null ) {
 throw new NullPointerException("Processors should not be 
null");
 }
 if( readRow() ) {
-super.executeProcessors(new 
ArrayList(getColumns().size()), processors);
+executeProcessors(new ArrayList(getColumns().size()), 
processors, getAllViolations);
 return new ArrayList(getColumns());
 }
 return null; // EOF
 }
 
+protected List executeProcessors(List 
processedColumns, CellProcessor[] processors, boolean getAllViolations) {
+  

[PR] NIFI-12593 - ValidateCSV - get all constraint violations for an invalid line [nifi]

2024-01-10 Thread via GitHub


pvillard31 opened a new pull request, #8229:
URL: https://github.com/apache/nifi/pull/8229

   # Summary
   
   [NIFI-12593](https://issues.apache.org/jira/browse/NIFI-12593) - ValidateCSV 
- get all constraint violations for an invalid line
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [ ] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue 
created
   
   ### Pull Request Tracking
   
   - [ ] Pull Request title starts with Apache NiFi Jira issue number, such as 
`NIFI-0`
   - [ ] Pull Request commit message starts with Apache NiFi Jira issue number, 
as such `NIFI-0`
   
   ### Pull Request Formatting
   
   - [ ] Pull Request based on current revision of the `main` branch
   - [ ] Pull Request refers to a feature branch with one commit containing 
changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request 
creation.
   
   ### Build
   
   - [ ] Build completed using `mvn clean install -P contrib-check`
 - [ ] JDK 21
   
   ### Licensing
   
   - [ ] New dependencies are compatible with the [Apache License 
2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License 
Policy](https://www.apache.org/legal/resolved.html)
   - [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` 
files
   
   ### Documentation
   
   - [ ] Documentation formatting appears as expected in rendered files
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org