<?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 make sure output from splitContent comes in the right order splitting hql code in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-make-sure-output-from-splitContent-comes-in-the-right/m-p/219767#M63007</link>
    <description>&lt;P&gt;What version of NiFi/HDF are you using? As of NiFi 1.2.0 or HDF 3.0.0, PutHiveQL supports multiple statements (via &lt;A href="https://issues.apache.org/jira/browse/NIFI-3031"&gt;NIFI-3031&lt;/A&gt;) and there is also an EnforceOrder processor (via &lt;A target="_blank" href="https://issues.apache.org/jira/browse/NIFI-3414"&gt;NIFI-3414&lt;/A&gt;), the latter of which could be configured to use the fragment.index attribute for the Order Attribute property and ${fragment.identifier} for the Group Identifier property.&lt;/P&gt;&lt;P&gt;Prior to NiFi 1.2.0, you can try adding an UpdateAttribute processor between SplitContent and PutHiveQL, setting the "priority" attribute to ${fragment.index}.  Then use a PriorityAttributePrioritizer on the connections between the SplitContent -&amp;gt; UpdateAttribute -&amp;gt; PutHiveQL. I'm not sure if this works as-is because &lt;A target="_blank" href="https://nifi.apache.org/docs/nifi-docs/html/user-guide.html#prioritization"&gt;the documentation&lt;/A&gt; suggests the priority comparator is lexicographical and not numeric. If that's the case, you'd need some Expression Language functions or an ExecuteScript processor to left-pad the fragment.index values with zeros to make them all the same length.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jun 2017 05:41:33 GMT</pubDate>
    <dc:creator>mburgess</dc:creator>
    <dc:date>2017-06-16T05:41:33Z</dc:date>
    <item>
      <title>How to make sure output from splitContent comes in the right order splitting hql code</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-make-sure-output-from-splitContent-comes-in-the-right/m-p/219766#M63006</link>
      <description>&lt;P&gt;I am generating my hql dynamically, but PutHiveQL can only executing one statement at the time so i have to split my hql op in separate flowfiles. &lt;/P&gt;&lt;P&gt;I do that by splitting following hql code on semicolon which gives my every hql step in each flowfile which i direct to PutHiveQL processor&lt;/P&gt;&lt;P&gt;My problem is that it does not sorts it in the order original hql steps was written.&lt;/P&gt;&lt;P&gt;It tries to create the table1_t2 before it tries to create table1_his and  errors out.&lt;/P&gt;&lt;P&gt;Can i do something to make sure that my hql flowfiles comes in the right order ?. &lt;/P&gt;&lt;P&gt;my hql&lt;/P&gt;&lt;PRE&gt;CREATE EXTERNAL  TABLE IF NOT EXISTS table1 
(
    col1       STRING,
 col2       STRING,
 col3       STRING,
 col4       STRING
 )
 COMMENT 'some Data '
    ROW FORMAT DELIMITED
    FIELDS TERMINATED BY '\011'
    STORED AS TEXTFILE
    location '/datapath';


drop table if exists table1_his;
create table archive_shared_csrp.table1_his STORED AS ORC location '/databank/work/work_ekapital/' as
 select  cpr_nr
       ,csrp_koersel_dto
       ,lag (csrp_koersel_dto,1,date '9999-12-31') over w                     as ETL_EXPIRATION_DATE
       ,case when row_number () over w = 1 then 'yes' else 'no' end     as ETL_ACTIVE
from    table1
window  w as (partition by cpr_nr order by csrp_koersel_dto desc)
; 


drop table if exists table1_t2;
create table table1_t2 STORED AS ORC  location '/datapath/T2' as
        select csrp.* ,his.ETL_EXPIRATION_DATE,ETL_ACTIVE,cast(TO_DATE(FROM_UNIXTIME( UNIX_TIMESTAMP() ) ) as string) as ETL_LOAD_DATE, csrp.INPUT__FILE__NAME AS ETL_FILENAME
        from table1 csrp 
        inner join archive_shared_csrp.table1_his his on his.cpr_nr = csrp.cpr_nr and his.csrp_koersel_dto = csrp.csrp_koersel_dto;


drop table if exists table1_t1;
create table table1_t1 STORED AS ORC  location '/datapath/T1' as
select *
         from table1_t2 csrp_t2
  where ETL_EXPIRATION_DATE = '9999-12-31' and ETL_ACTIVE = 'yes';
  
DROP TABLE IF EXISTS table1_delta;
CREATE EXTERNAL TABLE table1_delta
(
    col1       STRING,
 col2       STRING,
 col3       STRING,
 col4       STRING
 )
 COMMENT 'Data fra CSRP '
    ROW FORMAT DELIMITED
    FIELDS TERMINATED BY '\011'
    STORED AS TEXTFILE
    location '/datapath/current';
 
 drop table if exists table1_delta_base;
create table table1_delta_base STORED AS ORC  location '/datapath/DELTA' as
 select *
 ,cast(TO_DATE(FROM_UNIXTIME( UNIX_TIMESTAMP() ) ) as string) as ETL_LOAD_DATE
  ,INPUT__FILE__NAME AS ETL_FILENAME
 from table1_delta
 


&lt;/PRE&gt;&lt;P&gt;part of flow &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="16393-splitcontent1.png" style="width: 790px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/15950iF80BA87D2FB0C985/image-size/medium?v=v2&amp;amp;px=400" role="button" title="16393-splitcontent1.png" alt="16393-splitcontent1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;SpliContent Configuration&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="16394-splitcontent2.png" style="width: 720px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/15951i0D5BD3A91D15E30C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="16394-splitcontent2.png" alt="16394-splitcontent2.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 02:35:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-make-sure-output-from-splitContent-comes-in-the-right/m-p/219766#M63006</guid>
      <dc:creator>simon_jespersen</dc:creator>
      <dc:date>2019-08-18T02:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to make sure output from splitContent comes in the right order splitting hql code</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-make-sure-output-from-splitContent-comes-in-the-right/m-p/219767#M63007</link>
      <description>&lt;P&gt;What version of NiFi/HDF are you using? As of NiFi 1.2.0 or HDF 3.0.0, PutHiveQL supports multiple statements (via &lt;A href="https://issues.apache.org/jira/browse/NIFI-3031"&gt;NIFI-3031&lt;/A&gt;) and there is also an EnforceOrder processor (via &lt;A target="_blank" href="https://issues.apache.org/jira/browse/NIFI-3414"&gt;NIFI-3414&lt;/A&gt;), the latter of which could be configured to use the fragment.index attribute for the Order Attribute property and ${fragment.identifier} for the Group Identifier property.&lt;/P&gt;&lt;P&gt;Prior to NiFi 1.2.0, you can try adding an UpdateAttribute processor between SplitContent and PutHiveQL, setting the "priority" attribute to ${fragment.index}.  Then use a PriorityAttributePrioritizer on the connections between the SplitContent -&amp;gt; UpdateAttribute -&amp;gt; PutHiveQL. I'm not sure if this works as-is because &lt;A target="_blank" href="https://nifi.apache.org/docs/nifi-docs/html/user-guide.html#prioritization"&gt;the documentation&lt;/A&gt; suggests the priority comparator is lexicographical and not numeric. If that's the case, you'd need some Expression Language functions or an ExecuteScript processor to left-pad the fragment.index values with zeros to make them all the same length.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 05:41:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-make-sure-output-from-splitContent-comes-in-the-right/m-p/219767#M63007</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2017-06-16T05:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to make sure output from splitContent comes in the right order splitting hql code</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-make-sure-output-from-splitContent-comes-in-the-right/m-p/219768#M63008</link>
      <description>&lt;P&gt;Hi Matt, We are running HDF-2.1.2 planning to upgrade ASAP thanks for your anwser &lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 16:23:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-make-sure-output-from-splitContent-comes-in-the-right/m-p/219768#M63008</guid>
      <dc:creator>simon_jespersen</dc:creator>
      <dc:date>2017-06-19T16:23:00Z</dc:date>
    </item>
  </channel>
</rss>

