[ 
https://issues.apache.org/jira/browse/NIFI-14162?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

alexduta updated NIFI-14162:
----------------------------
    Description: 
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}
 

  was:
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" : "12346",
  "ProductCode" : "10102",
  "ArticleName" : "Business Card",
  "ProductName" : "Society Credit",
  "Country" : "RO"
},{
  "ArticleCode" : "12345",
  "ArticleName" : "Credit Card",
  "ProductCode" : "10101",
  "ProductName" : "Porduct 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}
 


> QueryRecord not following column order
> --------------------------------------
>
>                 Key: NIFI-14162
>                 URL: https://issues.apache.org/jira/browse/NIFI-14162
>             Project: Apache NiFi
>          Issue Type: Bug
>            Reporter: alexduta
>            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)

Reply via email to