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 Stieglitz (Jira)" <ji...@apache.org> on 2025/04/28 16:18:00 UTC
[jira] [Commented] (NIFI-14162) QueryRecord not following column order
[ https://issues.apache.org/jira/browse/NIFI-14162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17947884#comment-17947884 ]
Daniel Stieglitz commented on NIFI-14162:
-----------------------------------------
[~alexduta] When you saw this issue had you specified a schema for the JsonTreeReader or had you inferred the schema?
> QueryRecord not following column order
> --------------------------------------
>
> Key: NIFI-14162
> URL: https://issues.apache.org/jira/browse/NIFI-14162
> Project: Apache NiFi
> Issue Type: Bug
> Affects Versions: 2.0.0
> Reporter: alexduta
> Assignee: Daniel Stieglitz
> Priority: Minor
>
> It seems that, in Nifi, in the QueryRecord processor, if you define some columns you select from flowfile, it is following the order, but is taking the values in their order from the original flowfile.
> As an example:
> Original Json flowfile:
> {code:java}
> // [{
> "ArticleCode" : "12345",
> "ProductCode" : "10101",
> "ArticleName" : "Credit Card",
> "ProductName" : "Porduct Credit",
> "Country" : "RO"
> }] {code}
>
>
> Query:
>
> {code:java}
> // select ArticleCode,ArticleName,ProductCode,ProductName,Country from FLOWFILE
> {code}
>
>
> Returning file:
>
> {code:java}
> // [{
> "ArticleCode" : "12345",
> "ArticleName" : "10101",
> "ProductCode" : "Credit Card",
> "ProductName" : "Porduct Credit",
> "Country" : "RO"
> }] {code}
>
> So, it is somehow just adding the name of the columns, but is not changing the values.
>
> Otherwise, if one of the records in the flowfile has the correct order in it, the others will follow the correct rule:
> Original file:
> {code:java}
> // [{
> "ArticleCode" : "12345",
> "ArticleName" : "Credit Card",
> "ProductCode" : "10101",
> "ProductName" : "Porduct Credit",
> "Country" : "RO"
> },
> {
> "ArticleCode" : "12346",
> "ProductCode" : "10102",
> "ArticleName" : "Business Card",
> "ProductName" : "Society Credit",
> "Country" : "RO"
> }] {code}
> or
> {code:java}
> // [
> {
> "ArticleCode" : "12345",
> "ProductCode" : "10101",
> "ArticleName" : "Credit Card",
> "ProductName" : "Porduct Credit",
> "Country" : "RO"
> },{
> "ArticleCode" : "12346",
> "ArticleName" : "Business Card",
> "ProductCode" : "10102",
> "ProductName" : "Society Credit",
> "Country" : "RO"
> }] {code}
> Returning file:
> {code:java}
> // [{
> "ArticleCode" : "12345",
> "ArticleName" : "Credit Card",
> "ProductCode" : "10101",
> "ProductName" : "Porduct Credit",
> "Country" : "RO"
> },
> {
> "ArticleCode" : "12346",
> "ArticleName" : "Business Card",
> "ProductCode" : "10102",
> "ProductName" : "Society Credit",
> "Country" : "RO"
> }] {code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)