<?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: Naming splitted files incrementally in nifi for a particular table and then reset for another table in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Naming-splitted-files-incrementally-in-nifi-for-a-particular/m-p/215926#M79233</link>
    <description>&lt;A rel="user" href="https://community.cloudera.com/users/76186/amittal6.html" nodeid="76186" target="_blank"&gt;@aman
 mittal
&lt;/A&gt;&lt;P&gt;For this case use &lt;STRONG&gt;IfElse&lt;/STRONG&gt; function to check is the value exist for &lt;STRONG&gt;fragment.index&lt;/STRONG&gt; attribute if exists then then use the same value of &lt;STRONG&gt;fragement.index&lt;/STRONG&gt; if not exist(i.e filesize is less than 2GB) keep your default value&lt;STRONG&gt; 1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;UpdateAttributeConfigs:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="77608-updateattr-ifelse.png" style="width: 2242px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16276i336A88F1FE95DDBE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="77608-updateattr-ifelse.png" alt="77608-updateattr-ifelse.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;new_attribute
&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;${tab_name}_${fragment.index:isEmpty():ifElse('1','${fragment.index}')}&lt;/PRE&gt;&lt;P&gt;Refer to &lt;A href="https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#ifelse" rel="nofollow noopener noreferrer" target="_blank"&gt;this&lt;/A&gt; link for more details regarding ifelse function of NiFi expression language.&lt;/P&gt;</description>
    <pubDate>Sun, 18 Aug 2019 03:13:51 GMT</pubDate>
    <dc:creator>Shu_ashu</dc:creator>
    <dc:date>2019-08-18T03:13:51Z</dc:date>
    <item>
      <title>Naming splitted files incrementally in nifi for a particular table and then reset for another table</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Naming-splitted-files-incrementally-in-nifi-for-a-particular/m-p/215923#M79230</link>
      <description>&lt;P&gt;I am doing the following stuff in nifi :
Fetching data from tables in hive and then routing the flow files based 
on size :
If flowfile size is gt 2GB then split the flow file to multiple flow 
files of 2Gb each.
I want to use update attribute to name those splits like 
TableName_001_001,Tablename_001_002,Tablename_001_003 for a particular 
flow file or table .&lt;/P&gt;&lt;P&gt;When next flow file comes in the split it should also be named like above .&lt;/P&gt;&lt;P&gt;Is there any way we can do with the existing processor ?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 13:46:57 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Naming-splitted-files-incrementally-in-nifi-for-a-particular/m-p/215923#M79230</guid>
      <dc:creator>amittal6_</dc:creator>
      <dc:date>2018-06-06T13:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: Naming splitted files incrementally in nifi for a particular table and then reset for another table</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Naming-splitted-files-incrementally-in-nifi-for-a-particular/m-p/215924#M79231</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/76186/amittal6.html" nodeid="76186"&gt;@aman
 mittal
&lt;/A&gt;&lt;P&gt;If you are using any other processors &lt;STRONG&gt;Except SplitRecord&lt;/STRONG&gt; processor for splitting the flowfile into smaller chunks then each flowfile will have &lt;STRONG&gt;fragment.index&lt;/STRONG&gt; attribute associated with the flowfile.&lt;/P&gt;&lt;P&gt;As you are having table name as attribute to the flowfile and Make use of these &lt;STRONG&gt;attributes (table_name and fragment.index)&lt;/STRONG&gt; and combine them to one to &lt;STRONG&gt;Create the new required attribute&lt;/STRONG&gt;&lt;A href="https://i.stack.imgur.com/cF1Lt.png"&gt;&lt;IMG src="https://ip1.i.lithium.com/906e397490d8f19db1fab1000a4a5f97425b2052/68747470733a2f2f692e737461636b2e696d6775722e636f6d2f6346314c742e706e67" alt="enter image description here" style="margin: 0px; padding: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-family: inherit; vertical-align: baseline; box-sizing: inherit;" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I'm assuming the tab_name is the table name attribute and Add new property in update attribute processor and&lt;/P&gt;&lt;P&gt;In addition if you want to keep this attributes unique then you can add the timestamp value at the end like&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;new_attribute&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;${tab_name}_${fragment.index}_${now():toNumber()}&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;Based on the &lt;STRONG&gt;fragment.index and tab_name&lt;/STRONG&gt; attribute values we are creating new attribute value dynamically.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 18:19:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Naming-splitted-files-incrementally-in-nifi-for-a-particular/m-p/215924#M79231</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2018-06-06T18:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Naming splitted files incrementally in nifi for a particular table and then reset for another table</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Naming-splitted-files-incrementally-in-nifi-for-a-particular/m-p/215925#M79232</link>
      <description>&lt;P&gt;Thanks ! I also did manage to do by the same way !&lt;/P&gt;&lt;P&gt;But there is one thing which needs to be tweaked . Since I am using selectHiveQl Processor for fetching the data from hive and then routing the files to split processor if file size is greater than 2 GB . For all the unmatched files i.e files with size less than 2 GB will not have fragment.index attribute associated with them as they are passed through split text processor .&lt;/P&gt;&lt;P&gt;So You need to add the suffix tableName_001 using the update attribute processor to the table name attribute as it will not take the ${fragment.index} as it is null  .&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 11:57:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Naming-splitted-files-incrementally-in-nifi-for-a-particular/m-p/215925#M79232</guid>
      <dc:creator>amittal6_</dc:creator>
      <dc:date>2018-06-07T11:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: Naming splitted files incrementally in nifi for a particular table and then reset for another table</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Naming-splitted-files-incrementally-in-nifi-for-a-particular/m-p/215926#M79233</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/76186/amittal6.html" nodeid="76186" target="_blank"&gt;@aman
 mittal
&lt;/A&gt;&lt;P&gt;For this case use &lt;STRONG&gt;IfElse&lt;/STRONG&gt; function to check is the value exist for &lt;STRONG&gt;fragment.index&lt;/STRONG&gt; attribute if exists then then use the same value of &lt;STRONG&gt;fragement.index&lt;/STRONG&gt; if not exist(i.e filesize is less than 2GB) keep your default value&lt;STRONG&gt; 1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;UpdateAttributeConfigs:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="77608-updateattr-ifelse.png" style="width: 2242px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16276i336A88F1FE95DDBE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="77608-updateattr-ifelse.png" alt="77608-updateattr-ifelse.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;new_attribute
&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;${tab_name}_${fragment.index:isEmpty():ifElse('1','${fragment.index}')}&lt;/PRE&gt;&lt;P&gt;Refer to &lt;A href="https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#ifelse" rel="nofollow noopener noreferrer" target="_blank"&gt;this&lt;/A&gt; link for more details regarding ifelse function of NiFi expression language.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 03:13:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Naming-splitted-files-incrementally-in-nifi-for-a-particular/m-p/215926#M79233</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-18T03:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: Naming splitted files incrementally in nifi for a particular table and then reset for another table</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Naming-splitted-files-incrementally-in-nifi-for-a-particular/m-p/215927#M79234</link>
      <description>&lt;P&gt;Appreciate your response !&lt;/P&gt;&lt;P&gt;I did the same using the Advanced property section of UpdateAttribute to create rules and actions as i have to append leading 0's since I need the fragment index appended in three digit like 001,020,100 ...&lt;/P&gt;&lt;P&gt;I have created three rules to check if the fragment index is less than 10 then make fragment.index = 00${fragment.index}&lt;/P&gt;&lt;P&gt;if it is more than 9 and less than 100 then fragment.index = 0${fragment.index}&lt;/P&gt;&lt;P&gt;else fragment.index = ${fragment.index}&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 18:06:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Naming-splitted-files-incrementally-in-nifi-for-a-particular/m-p/215927#M79234</guid>
      <dc:creator>amittal6_</dc:creator>
      <dc:date>2018-06-07T18:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: Naming splitted files incrementally in nifi for a particular table and then reset for another table</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Naming-splitted-files-incrementally-in-nifi-for-a-particular/m-p/215928#M79235</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/76186/amittal6.html" nodeid="76186"&gt;@aman
 mittal
&lt;/A&gt;&lt;P&gt;Great, Good to know that..!!&lt;/P&gt;&lt;P&gt;Other way of doing by checking the &lt;STRONG&gt;length &lt;/STRONG&gt;of&lt;STRONG&gt; fragment.index&lt;/STRONG&gt; attribute then using nested &lt;STRONG&gt;ifelse&lt;/STRONG&gt; statements to determine the prepend by 00,0. but the expression will become complex using Advanced property will be good approach.&lt;/P&gt;&lt;P&gt;If the Answer addressed your question, Take a moment to Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of issues.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 18:25:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Naming-splitted-files-incrementally-in-nifi-for-a-particular/m-p/215928#M79235</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2018-06-07T18:25:25Z</dc:date>
    </item>
  </channel>
</rss>

