Subversion Repositories SmartDukaan

Rev

Rev 5905 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?xml version="1.0" encoding="UTF-8"?>
<transformation>
  <info>
    <name>repeatLoader</name>
    <description/>
    <extended_description/>
    <trans_version/>
    <trans_type>Normal</trans_type>
    <directory>&#47;</directory>
    <parameters>
    </parameters>
    <log>
<trans-log-table><connection/>
<schema/>
<table/>
<size_limit_lines/>
<interval/>
<timeout_days/>
<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STATUS</id><enabled>Y</enabled><name>STATUS</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name><subject/></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name><subject/></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name><subject/></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name><subject/></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name><subject/></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name><subject/></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>STARTDATE</id><enabled>Y</enabled><name>STARTDATE</name></field><field><id>ENDDATE</id><enabled>Y</enabled><name>ENDDATE</name></field><field><id>LOGDATE</id><enabled>Y</enabled><name>LOGDATE</name></field><field><id>DEPDATE</id><enabled>Y</enabled><name>DEPDATE</name></field><field><id>REPLAYDATE</id><enabled>Y</enabled><name>REPLAYDATE</name></field><field><id>LOG_FIELD</id><enabled>Y</enabled><name>LOG_FIELD</name></field></trans-log-table>
<perf-log-table><connection/>
<schema/>
<table/>
<interval/>
<timeout_days/>
<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>SEQ_NR</id><enabled>Y</enabled><name>SEQ_NR</name></field><field><id>LOGDATE</id><enabled>Y</enabled><name>LOGDATE</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STEPNAME</id><enabled>Y</enabled><name>STEPNAME</name></field><field><id>STEP_COPY</id><enabled>Y</enabled><name>STEP_COPY</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>INPUT_BUFFER_ROWS</id><enabled>Y</enabled><name>INPUT_BUFFER_ROWS</name></field><field><id>OUTPUT_BUFFER_ROWS</id><enabled>Y</enabled><name>OUTPUT_BUFFER_ROWS</name></field></perf-log-table>
<channel-log-table><connection/>
<schema/>
<table/>
<timeout_days/>
<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>LOGGING_OBJECT_TYPE</id><enabled>Y</enabled><name>LOGGING_OBJECT_TYPE</name></field><field><id>OBJECT_NAME</id><enabled>Y</enabled><name>OBJECT_NAME</name></field><field><id>OBJECT_COPY</id><enabled>Y</enabled><name>OBJECT_COPY</name></field><field><id>REPOSITORY_DIRECTORY</id><enabled>Y</enabled><name>REPOSITORY_DIRECTORY</name></field><field><id>FILENAME</id><enabled>Y</enabled><name>FILENAME</name></field><field><id>OBJECT_ID</id><enabled>Y</enabled><name>OBJECT_ID</name></field><field><id>OBJECT_REVISION</id><enabled>Y</enabled><name>OBJECT_REVISION</name></field><field><id>PARENT_CHANNEL_ID</id><enabled>Y</enabled><name>PARENT_CHANNEL_ID</name></field><field><id>ROOT_CHANNEL_ID</id><enabled>Y</enabled><name>ROOT_CHANNEL_ID</name></field></channel-log-table>
<step-log-table><connection/>
<schema/>
<table/>
<timeout_days/>
<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STEPNAME</id><enabled>Y</enabled><name>STEPNAME</name></field><field><id>STEP_COPY</id><enabled>Y</enabled><name>STEP_COPY</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>LOG_FIELD</id><enabled>N</enabled><name>LOG_FIELD</name></field></step-log-table>
    </log>
    <maxdate>
      <connection/>
      <table/>
      <field/>
      <offset>0.0</offset>
      <maxdiff>0.0</maxdiff>
    </maxdate>
    <size_rowset>10000</size_rowset>
    <sleep_time_empty>50</sleep_time_empty>
    <sleep_time_full>50</sleep_time_full>
    <unique_connections>N</unique_connections>
    <feedback_shown>Y</feedback_shown>
    <feedback_size>50000</feedback_size>
    <using_thread_priorities>Y</using_thread_priorities>
    <shared_objects_file/>
    <capture_step_performance>N</capture_step_performance>
    <step_performance_capturing_delay>1000</step_performance_capturing_delay>
    <step_performance_capturing_size_limit>100</step_performance_capturing_size_limit>
    <dependencies>
    </dependencies>
    <partitionschemas>
    </partitionschemas>
    <slaveservers>
    </slaveservers>
    <clusterschemas>
    </clusterschemas>
  <created_user>-</created_user>
  <created_date>2012&#47;08&#47;26 11:16:19.521</created_date>
  <modified_user>-</modified_user>
  <modified_date>2012&#47;08&#47;26 11:16:19.521</modified_date>
  </info>
  <notepads>
  </notepads>
  <connection>
    <name>salesLocalTest</name>
    <server>localhost</server>
    <type>MYSQL</type>
    <access>Native</access>
    <database>sales</database>
    <port>3306</port>
    <username>root</username>
    <password>Encrypted 2be98afc86aa7f2e4b811a1608cc2fd8a</password>
    <servername/>
    <data_tablespace/>
    <index_tablespace/>
    <attributes>
      <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
      <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
      <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
      <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
      <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
      <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
      <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
      <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
      <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
      <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
    </attributes>
  </connection>
  <connection>
    <name>tranLocal</name>
    <server>localhost</server>
    <type>MYSQL</type>
    <access>Native</access>
    <database>transaction</database>
    <port>3306</port>
    <username>root</username>
    <password>Encrypted 2be98afc86aa7f2e4b811a1608cc2fd8a</password>
    <servername/>
    <data_tablespace/>
    <index_tablespace/>
    <attributes>
      <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
      <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
      <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
      <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
      <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
      <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
      <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
      <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
      <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
      <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
    </attributes>
  </connection>
  <connection>
    <name>tranProd</name>
    <server>192.168.190.113</server>
    <type>MYSQL</type>
    <access>Native</access>
    <database>transaction</database>
    <port>3306</port>
    <username>pentaho</username>
    <password>Encrypted 2be98afc86aa7f2e4cb79ac798cc2fd8a</password>
    <servername/>
    <data_tablespace/>
    <index_tablespace/>
    <attributes>
      <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
      <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
      <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
      <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
      <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
      <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
      <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
      <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
      <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
      <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
    </attributes>
  </connection>
  <order>
  <hop> <from>customersInput</from><to>Table output</to><enabled>Y</enabled> </hop>  </order>
  <step>
    <name>Table output</name>
    <type>TableOutput</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <connection>salesLocalTest</connection>
    <schema>sales</schema>
    <table>repeatSales</table>
    <commit>1000</commit>
    <truncate>Y</truncate>
    <ignore_errors>N</ignore_errors>
    <use_batch>Y</use_batch>
    <specify_fields>N</specify_fields>
    <partitioning_enabled>N</partitioning_enabled>
    <partitioning_field/>
    <partitioning_daily>N</partitioning_daily>
    <partitioning_monthly>Y</partitioning_monthly>
    <tablename_in_field>N</tablename_in_field>
    <tablename_field/>
    <tablename_in_table>Y</tablename_in_table>
    <return_keys>N</return_keys>
    <return_field/>
    <fields>
        <field>
          <column_name>customer_id</column_name>
          <stream_name>customer_id</stream_name>
        </field>
        <field>
          <column_name>orderCount</column_name>
          <stream_name>orderCount</stream_name>
        </field>
        <field>
          <column_name>grandTotal</column_name>
          <stream_name>grandTotal</stream_name>
        </field>
        <field>
          <column_name>date_id1</column_name>
          <stream_name>date_id1</stream_name>
        </field>
        <field>
          <column_name>date_id2</column_name>
          <stream_name>date_id2</stream_name>
        </field>
        <field>
          <column_name>paymode1</column_name>
          <stream_name>paymode1</stream_name>
        </field>
        <field>
          <column_name>paymode2</column_name>
          <stream_name>paymode2</stream_name>
        </field>
        <field>
          <column_name>price_range1</column_name>
          <stream_name>price_range1</stream_name>
        </field>
        <field>
          <column_name>price_range2</column_name>
          <stream_name>price_range2</stream_name>
        </field>
        <field>
          <column_name>pin</column_name>
          <stream_name>pin</stream_name>
        </field>
        <field>
          <column_name>session_source_type1</column_name>
          <stream_name>session_source_type1</stream_name>
        </field>
        <field>
          <column_name>session_source_url1</column_name>
          <stream_name>session_source_url1</stream_name>
        </field>
        <field>
          <column_name>session_source_type2</column_name>
          <stream_name>session_source_type2</stream_name>
        </field>
        <field>
          <column_name>session_source_url2</column_name>
          <stream_name>session_source_url2</stream_name>
        </field>
        <field>
          <column_name>item1</column_name>
          <stream_name>item1</stream_name>
        </field>
        <field>
          <column_name>item2</column_name>
          <stream_name>item2</stream_name>
        </field>
        <field>
          <column_name>averageValue</column_name>
          <stream_name>averageValue</stream_name>
        </field>
        <field>
          <column_name>daysToFirstPurchase</column_name>
          <stream_name>daysToFirstPurchase</stream_name>
        </field>
        <field>
          <column_name>daysToSecondPurchase</column_name>
          <stream_name>daysToSecondPurchase</stream_name>
        </field>
    </fields>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>589</xloc>
      <yloc>125</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>customersInput</name>
    <type>TableInput</type>
    <description/>
    <distribute>Y</distribute>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <connection>tranProd</connection>
    <sql>select 
        o1.customer_id, temp.orderCount, 
        case when temp.grandTotal&lt;250 then 0 when temp.grandTotal&lt;500 then 1 when temp.grandTotal&lt;1000 then 2 when temp.grandTotal&lt;2000 then 3 when temp.grandTotal &lt; 5000 then 4 when temp.grandTotal &lt; 10000 then 5 when temp.grandTotal &lt; 15000 then 6 when temp.grandTotal &lt;20000 then 7 when temp.grandTotal &lt; 50000 then 8 else 9 end as grandTotal, 
        case when (temp.averageValue)&lt;250 then 0 when temp.averageValue&lt;500 then 1 when temp.averageValue&lt;1000 then 2 when temp.averageValue&lt;2000 then 3 when temp.averageValue &lt; 5000 then 4 when temp.averageValue &lt; 10000 then 5 when temp.averageValue &lt; 15000 then 6 when temp.averageValue &lt;20000 then 7 when temp.averageValue &lt; 50000 then 8 else 9 end as averageValue, 
        datediff(o1.created_timestamp, &apos;20101231&apos;) as date_id1, datediff(o2.created_timestamp, &apos;20101231&apos;) as date_id2, 
        case when o1.cod = 1 then 1 when o1.cod = 0 then 0 else null end as paymode1,
        case when o2.cod = 1 then 1 when o2.cod = 0 then 0 else null end as paymode2, 
        case when o1.total_amount&lt;250 then 0 when o1.total_amount&lt;500 then 1 when o1.total_amount&lt;1000 then 2 when o1.total_amount&lt;2000 then 3 when o1.total_amount &lt; 5000 then 4 when o1.total_amount &lt; 10000 then 5 when o1.total_amount &lt; 15000 then 6 when o1.total_amount &lt;20000 then 7 when o1.total_amount &lt; 50000 then 8 else 9 end as price_range1,
        case when o2.total_amount is null then 99 when o2.total_amount&lt;250 then 0 when o2.total_amount&lt;500 then 1 when o2.total_amount&lt;1000 then 2 when o2.total_amount&lt;2000 then 3 when o2.total_amount &lt; 5000 then 4 when o2.total_amount &lt; 10000 then 5 when o2.total_amount &lt; 15000 then 6 when o2.total_amount &lt;20000 then 7 when o2.total_amount &lt; 50000 then 8 else 9 end as price_range2,
        o1.customer_pincode as pin, 
        case when t1.session_source is null then &apos;Unknown&apos; when t1.session_source like &apos;DIRECT%&apos; then &apos;Direct&apos; when t1.session_source like &apos;ORGANIC%&apos; then &apos;Organic&apos; when t1.session_source like &apos;PAID%&apos; then &apos;Paid&apos; else &apos;Referer&apos; end as session_source_type1,
        SUBSTRING_INDEX(REPLACE(REPLACE(SUBSTR(t1.session_source, LOCATE(&apos;http:&#47;&#47;&apos;, LCASE(t1.session_source)), LENGTH(t1.session_source)), &apos;http:&#47;&#47;&apos;, &apos;&apos;), &apos;www.&apos;, &apos;&apos;), &apos;&#47;&apos;, 1) as session_source_url1, 
        case when t2.session_source is null then &apos;Unknown&apos; when t2.session_source like &apos;DIRECT%&apos; then &apos;Direct&apos; when t2.session_source like &apos;ORGANIC%&apos; then &apos;Organic&apos; when t2.session_source like &apos;PAID%&apos; then &apos;Paid&apos; else &apos;Referer&apos; end as session_source_type2,
        SUBSTRING_INDEX(REPLACE(REPLACE(SUBSTR(t2.session_source, LOCATE(&apos;http:&#47;&#47;&apos;, LCASE(t2.session_source)), LENGTH(t2.session_source)), &apos;http:&#47;&#47;&apos;, &apos;&apos;), &apos;www.&apos;, &apos;&apos;), &apos;&#47;&apos;, 1) as session_source_url2, 
        l1.item_id as item1, l2.item_id as item2, 
        case when datediff(o1.created_timestamp, u.active_since) &gt; 30 then 0 when datediff(o1.created_timestamp, u.active_since) &gt; 15 then 1
        when datediff(o1.created_timestamp, u.active_since) &gt; 7 then 2 when datediff(o1.created_timestamp, u.active_since) &gt; 2 then 3
        when datediff(o1.created_timestamp, u.active_since) &gt; 1 then 4 else 5 end as daysToFirstPurchase,
        case when o2.created_timestamp is null then 99 when datediff(o2.created_timestamp, o1.created_timestamp) &gt; 30 then 0 when datediff(o2.created_timestamp, o1.created_timestamp) &gt; 15 then 1
        when datediff(o2.created_timestamp, o1.created_timestamp) &gt; 7 then 2 when datediff(o2.created_timestamp, o1.created_timestamp) &gt; 2 then 3
        when datediff(o2.created_timestamp, o1.created_timestamp) &gt; 1 then 4 else 5 end as daysToSecondPurchase
        
from 
        (select (count(o.id)+1) as orderCount, m.min_orderId, min(o.id) as second_min_orderId, m.grandTotal, (m.grandTotal&#47;(count(o.id)+1)) as averageValue
        from `order` o 
        right join 
                (select customer_id, sum(total_amount) as grandTotal, min(id) as min_orderId 
                from `order` o 
                where status not in (0,1,8,11,28,29,30,47,49,53,55,69,71,73,75,78) 
                group by customer_id) as m 
        on (o.customer_id = m.customer_id and o.id &gt; m.min_orderId and o.status not in (0,1,8,11,28,29,30,47,49,53,55,69,71,73,75,78)) 
        group by m.customer_id) as temp 
join `order` o1 on temp.min_orderId = o1.id 
left join `order` o2 on (o2.id = temp.second_min_orderId and o2.transaction_id != o1.transaction_id)
left join transaction t1 on o1.transaction_id = t1.id 
left join transaction t2 on o2.transaction_id = t2.id 
left join lineitem l1 on o1.id = l1.order_id 
left join lineitem l2 on l2.order_id = o2.id 
left join user.user u on o1.customer_id = u.id</sql>
    <limit>0</limit>
    <lookup/>
    <execute_each_row>N</execute_each_row>
    <variables_active>N</variables_active>
    <lazy_conversion_active>N</lazy_conversion_active>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>147</xloc>
      <yloc>140</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step_error_handling>
  </step_error_handling>
   <slave-step-copy-partition-distribution>
</slave-step-copy-partition-distribution>
   <slave_transformation>N</slave_transformation>
</transformation>