<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How to merge many json files together using one common field? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-merge-many-json-files-together-using-one-common-field/m-p/330851#M230771</link>
    <description>&lt;P&gt;Thank you for your answer! All my json FlowFiles have a FlowFile attribute on them for "table_name". There may be a problem with the json schema itself. Now the task has changed. I have created a new question about Jolt.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.cloudera.com/t5/Support-Questions/Jolt-transform/td-p/330850" target="_blank"&gt;https://community.cloudera.com/t5/Support-Questions/Jolt-transform/td-p/330850&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you know the answer to it, I would be very grateful!&lt;/P&gt;</description>
    <pubDate>Tue, 23 Nov 2021 15:25:15 GMT</pubDate>
    <dc:creator>Protector</dc:creator>
    <dc:date>2021-11-23T15:25:15Z</dc:date>
    <item>
      <title>How to merge many json files together using one common field?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-merge-many-json-files-together-using-one-common-field/m-p/330800#M230764</link>
      <description>&lt;P&gt;Hello everyone!&lt;/P&gt;&lt;P&gt;I have many json files like this:&lt;BR /&gt;&lt;BR /&gt;{&lt;BR /&gt;"table_name" : "train_vd",&lt;BR /&gt;"data" : [ {&lt;BR /&gt;"battery_power" : 1954,&lt;BR /&gt;"clock_speed" : 0.5&lt;BR /&gt;} ]&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"table_name" : "train_vd",&lt;BR /&gt;"data" : [ {&lt;BR /&gt;"battery_power" : 842,&lt;BR /&gt;"clock_speed" : 2.2&lt;BR /&gt;} ]&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the MergeContent and MergeRecord processors and used the table_name field as the Correlation Attribute Name (i have ${table_name} attribute). However, this does not work and the result is as follows:&lt;BR /&gt;&lt;BR /&gt;[{&lt;BR /&gt;"table_name" : "train_vd",&lt;BR /&gt;"data" : [ {&lt;BR /&gt;"battery_power" : 509,&lt;BR /&gt;"clock_speed" : 0.6&lt;BR /&gt;} ]&lt;BR /&gt;}{&lt;BR /&gt;"table_name" : "train_vd",&lt;BR /&gt;"data" : [ {&lt;BR /&gt;"battery_power" : 842,&lt;BR /&gt;"clock_speed" : 2.2&lt;BR /&gt;} ]&lt;BR /&gt;}]&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I want to get the following result:&lt;/P&gt;&lt;P&gt;[{&lt;BR /&gt;"table_name" : "train_vd",&lt;BR /&gt;"data" : [ {&lt;BR /&gt;"battery_power" : 509,&lt;BR /&gt;"clock_speed" : 0.6&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"battery_power" : 842,&lt;BR /&gt;"clock_speed" : 2.2&lt;BR /&gt;}]&lt;BR /&gt;}]&lt;BR /&gt;&lt;BR /&gt;May you tell me how to solve this problem?&amp;nbsp;Need i use a complex Jolt transformation or to configure the incoming Avro schema in the MergeRecord&amp;nbsp;processor, so that then everything is combined using a single field?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 09:55:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-merge-many-json-files-together-using-one-common-field/m-p/330800#M230764</guid>
      <dc:creator>Protector</dc:creator>
      <dc:date>2021-11-23T09:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge many json files together using one common field?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-merge-many-json-files-together-using-one-common-field/m-p/330823#M230768</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/93767"&gt;@Protector&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Do all your json FlowFiles have a FlowFile attribute on them for "&lt;SPAN&gt;table_name".&amp;nbsp; It is not pulling table_name from the FlowFIle content (your json content) itself.&lt;BR /&gt;&lt;BR /&gt;The&amp;nbsp;&lt;/SPAN&gt;Correlation Attribute Name property in the MergeContent processors is looking for this FlowFile Attribute on each incoming FlowFile in order to allocate those FlowFiles with same value assign to that FlowFile attribute to the same bin.&amp;nbsp; Then a bin is merged when it meets the other configured mins on the MergeContent, max bin age is reached, or all bins have files allocated to them and another bin is needed forcing the merge of the oldest bin.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you found this response assisted with your query, please take a moment to login and click on "&lt;STRONG&gt;Accept as Solution&lt;/STRONG&gt;" below this post.&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 13:26:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-merge-many-json-files-together-using-one-common-field/m-p/330823#M230768</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2021-11-23T13:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge many json files together using one common field?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-merge-many-json-files-together-using-one-common-field/m-p/330851#M230771</link>
      <description>&lt;P&gt;Thank you for your answer! All my json FlowFiles have a FlowFile attribute on them for "table_name". There may be a problem with the json schema itself. Now the task has changed. I have created a new question about Jolt.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.cloudera.com/t5/Support-Questions/Jolt-transform/td-p/330850" target="_blank"&gt;https://community.cloudera.com/t5/Support-Questions/Jolt-transform/td-p/330850&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you know the answer to it, I would be very grateful!&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 15:25:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-merge-many-json-files-together-using-one-common-field/m-p/330851#M230771</guid>
      <dc:creator>Protector</dc:creator>
      <dc:date>2021-11-23T15:25:15Z</dc:date>
    </item>
  </channel>
</rss>

