Github user patricker commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/3075#discussion_r233524977
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateTableFetch.java
 ---
    @@ -450,7 +450,33 @@ public void onTrigger(final ProcessContext context, 
final ProcessSessionFactory
     
                     // 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);
    +                    FlowFile emptyFlowFile = (fileToProcess == null) ? 
session.create() : session.create(fileToProcess);
    +                    Map<String, String> attributesToAdd = new HashMap<>();
    +
    +                    attributesToAdd.put("generatetablefetch.tableName", 
tableName);
    +                    if (columnNames != null) {
    +                        
attributesToAdd.put("generatetablefetch.columnNames", columnNames);
    +                    }
    +                    whereClause = maxValueClauses.isEmpty() ? "1=1" : 
StringUtils.join(maxValueClauses, " AND ");
    +                    if (StringUtils.isNotBlank(whereClause)) {
    +                        
attributesToAdd.put("generatetablefetch.whereClause", whereClause);
    +                    }
    +                    final String maxColumnNames = 
StringUtils.join(maxValueColumnNameList, ", ");
    +                    if (StringUtils.isNotBlank(maxColumnNames)) {
    +                        
attributesToAdd.put("generatetablefetch.maxColumnNames", maxColumnNames);
    +                    }
    +                    attributesToAdd.put("generatetablefetch.limit", null);
    --- End diff --
    
    There is no existing test in `master`, but I think in normal circumstances 
`limit` actually gets written as `"null"`.
    
    ```
    if ((i == numberOfFetches - 1) && useColumnValsForPaging && 
(maxValueClauses.isEmpty() || customWhereClause != null)) {
                                maxValueClauses.add(columnForPartitioning + " 
<= " + maxValueForPartitioning);
                                limit = null;
                            }
    ```
    
    This value is then written using `String.valueOf(limit)`, which is going to 
translate the `null` to `"null"`.


---

Reply via email to