You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Daniel Lorych (Jira)" <ji...@apache.org> on 2020/08/05 20:15:00 UTC
[jira] [Updated] (NIFI-7711) GenerateTableFetch generates fetch on
empty table
[ https://issues.apache.org/jira/browse/NIFI-7711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Lorych updated NIFI-7711:
--------------------------------
Summary: GenerateTableFetch generates fetch on empty table (was: GenerateTableFetch where clause with 1=1 leads t )
> GenerateTableFetch generates fetch on empty table
> -------------------------------------------------
>
> Key: NIFI-7711
> URL: https://issues.apache.org/jira/browse/NIFI-7711
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Affects Versions: 1.11.4
> Reporter: Daniel Lorych
> Priority: Major
>
> h6. Description
> GenerateTableFetch generates "select all" where clause (1=1) for an empty table, which leads to inconsistent state (and duplicate flowfiles).
> Generated SQL statement (1=1) can return values, which were created after collecting max values during statement generation. On a subsequent run, with existing data, the statement will contain a where clause with maxValue limited.
> h6. Environment:
> * Table is empty
> * 'Maximum-value Columns' property is set to PK
> * 'Partition Size' property set to 0
>
> h6. Expected behaviour:
> Fetch statement should not be generated.
> h6. Root Cause:
> `numberOfFetches` is calculated incorrectly for `partitionSize == 0`. Calculation should take into account returned `rowCount`.
> [GenerateTableFetch.java#L462|https://github.com/apache/nifi/blob/4d940bb151eb8d250b0319318b96d23c4a9819ae/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateTableFetch.java#L462]
> h6. Possible fix:
> {code:java}
> numberOfFetches = (partitionSize == 0) ? (rowCount == 0 ? 0 : 1) : (rowCount / partitionSize) + (rowCount % partitionSize == 0 ? 0 : 1);
> {code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)