Github user mattyb149 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/3075#discussion_r233142376
--- Diff:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateTableFetch.java
---
@@ -434,48 +448,53 @@ public void onTrigger(final ProcessContext context,
final ProcessSessionFactory
numberOfFetches = (partitionSize == 0) ? 1 : (rowCount
/ partitionSize) + (rowCount % partitionSize == 0 ? 0 : 1);
}
- // Generate SQL statements to read "pages" of data
- Long limit = partitionSize == 0 ? null : (long)
partitionSize;
- final String fragmentIdentifier =
UUID.randomUUID().toString();
- for (long i = 0; i < numberOfFetches; i++) {
- // Add a right bounding for the partitioning column if
necessary (only on last partition, meaning we don't need the limit)
- if ((i == numberOfFetches - 1) &&
useColumnValsForPaging && (maxValueClauses.isEmpty() || customWhereClause !=
null)) {
- maxValueClauses.add(columnForPartitioning + " <= "
+ maxValueForPartitioning);
- limit = null;
- }
+ // If there are no SQL statements to be generated, still
output an empty flow file if specified by the user
+ if (numberOfFetches == 0 &&
outputEmptyFlowFileOnZeroResults) {
+ session.transfer((fileToProcess == null) ?
session.create() : session.create(fileToProcess), REL_SUCCESS);
--- End diff --
Good call, will make the change.
---