[
https://issues.apache.org/jira/browse/NIFI-14994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Knagwei Zhu updated NIFI-14994:
-------------------------------
External issue URL: https://github.com/apache/nifi/pull/10325
> TestQueryRecord Test Failures on NonDex
> ---------------------------------------
>
> Key: NIFI-14994
> URL: https://issues.apache.org/jira/browse/NIFI-14994
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Environment: Apache Maven 3.9.11
> (3e54c93a704957b63ee3494413a2b544fd3d825b)
> Maven home: /home/anicaazhu/.sdkman/candidates/maven/current
> Java version: 21.0.7, vendor: Oracle Corporation, runtime:
> /home/anicaazhu/.sdkman/candidates/java/21.0.7-oracle
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux", version: "6.16.7-arch1-1", arch: "amd64", family: "unix"
> Reporter: Knagwei Zhu
> Priority: Minor
> Fix For: 2.6.0
>
> Original Estimate: 10m
> Time Spent: 10m
> Remaining Estimate: 0h
>
> The test *org.apache.nifi.processors.standard.TestQueryRecord.*
> {*}testAggregateFunction({*}nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestQueryRecord.java{*}){*}
> passed using normal maven-test, but showed Non-deterministic behavior under
> NonDex([https://github.com/TestingResearchIllinois/NonDex)] and thus failed.
> Some of the error messages are:
>
> ```
> Build Failure observed:
> expected:
> "name","points" "Tom","100" "Jerry","2"
> but was:
> "name","points" "Jerry","2" "Tom","100"
> ```
>
> Steps to reproduce:
> ```
> mvn clean install -DskipTests -T1C
> ```
> ```
> mvn -pl nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors \
> edu.illinois:nondex-maven-plugin:2.2.1:nondex \
>
> -Dtest=org.apache.nifi.processors.standard.TestQueryRecord#testAggregateFunction
> ````
>
> Root cause:
> * The test asserted a fixed row order on the result of a SQL GROUP BY query.
> * GROUP BY does not guarantee ordering; Calcite (used in QueryRecord) may
> return rows in different orders depending on internal HashMap iteration.
> * This led to nondeterministic test outcomes.
> Fix:
> * Add ORDER BY clause ({{{}ORDER BY points DESC{}}}) in {{TestQueryRecord}}
> class's {{testAggregateFunction}} method's test SQL so row order is
> deterministic.
> * This stabilizes assertions {*}without altering QueryRecord processor
> logic, and the purpose of this testing aggregation function{*}.
> Confirm Fixed:
> Re-run
> ```
> mvn -pl nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors \
> edu.illinois:nondex-maven-plugin:2.2.1:nondex \
>
> -Dtest=org.apache.nifi.processors.standard.TestQueryRecord#testAggregateFunction
> ```
> And the result is {{Tests run: 1, Failures: 0, Errors: 0, Skipped: 0}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)