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

    https://github.com/apache/nifi/pull/1376#discussion_r101172664
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateTableFetch.java
 ---
    @@ -223,19 +237,34 @@ public void onTrigger(final ProcessContext context, 
final ProcessSessionFactory
                 }
                 final int numberOfFetches = (partitionSize == 0) ? rowCount : 
(rowCount / partitionSize) + (rowCount % partitionSize == 0 ? 0 : 1);
     
    +            if("null".equals(indexValue)) {
    +                // Generate SQL statements to read "pages" of data
    +                for (int i = 0; i < numberOfFetches; i++) {
    +                    FlowFile sqlFlowFile;
     
    -            // Generate SQL statements to read "pages" of data
    -            for (int i = 0; i < numberOfFetches; i++) {
    -                FlowFile sqlFlowFile;
    +                    Integer limit = partitionSize == 0 ? null : 
partitionSize;
    +                    Integer offset = partitionSize == 0 ? null : i * 
partitionSize;
    +                    final String query = 
dbAdapter.getSelectStatement(tableName, columnNames, whereClause, 
StringUtils.join(maxValueColumnNameList, ", "), limit, offset);
    +                    sqlFlowFile = session.create();
    +                    sqlFlowFile = session.write(sqlFlowFile, out -> {
    +                        out.write(query.getBytes());
    +                    });
    +                    session.transfer(sqlFlowFile, REL_SUCCESS);
    +                }
    +            }else {
    +                for (int i = 0; i < numberOfFetches; i++) {
    +                    FlowFile sqlFlowFile;
     
    -                Integer limit = partitionSize == 0 ? null : partitionSize;
    -                Integer offset = partitionSize == 0 ? null : i * 
partitionSize;
    -                final String query = 
dbAdapter.getSelectStatement(tableName, columnNames, whereClause, 
StringUtils.join(maxValueColumnNameList, ", "), limit, offset);
    -                sqlFlowFile = session.create();
    -                sqlFlowFile = session.write(sqlFlowFile, out -> {
    -                    out.write(query.getBytes());
    -                });
    -                session.transfer(sqlFlowFile, REL_SUCCESS);
    +                    Integer limit = partitionSize;
    +                    whereClause = indexValue + " >= " + limit * i;
    --- End diff --
    
    Thank you for your advice. I will work on it and solve the conflit.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to