<?xml version="1.0" encoding="UTF-8"?>
<pipeline>
  <info>
    <name>recruitment_five_flow_delta</name>
    <name_sync_with_filename>Y</name_sync_with_filename>
    <description/>
    <extended_description/>
    <pipeline_version/>
    <pipeline_type>Normal</pipeline_type>
    <parameters>
    </parameters>
    <capture_transform_performance>N</capture_transform_performance>
    <transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
    <transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
    <created_user>-</created_user>
    <created_date>2025/09/08 20:38:40.987</created_date>
    <modified_user>-</modified_user>
    <modified_date>2025/09/08 20:38:40.987</modified_date>
  </info>
  <notepads>
  </notepads>
  <order>
    <hop>
      <from>Table input</from>
      <to>sport_flow_delta.hpl</to>
      <enabled>Y</enabled>
    </hop>
    <hop>
      <from>get_max_source_update_date</from>
      <to>Table input</to>
      <enabled>Y</enabled>
    </hop>
    <hop>
      <from>Table input</from>
      <to>sport_flow_delta.hpl 2</to>
      <enabled>Y</enabled>
    </hop>
    <hop>
      <from>Table input</from>
      <to>sport_flow_delta.hpl 3</to>
      <enabled>Y</enabled>
    </hop>
    <hop>
      <from>Table input</from>
      <to>sport_flow_delta.hpl 4</to>
      <enabled>Y</enabled>
    </hop>
    <hop>
      <from>Table input</from>
      <to>sport_flow_delta.hpl 5</to>
      <enabled>Y</enabled>
    </hop>
  </order>
  <transform>
    <name>Table input</name>
    <type>TableInput</type>
    <description/>
    <distribute>Y</distribute>
    <custom_distribution/>
    <copies>1</copies>
    <partitioning>
      <method>none</method>
      <schema_name/>
    </partitioning>
    <connection>ervu-dashboard</connection>
    <execute_each_row>N</execute_each_row>
    <limit>0</limit>
    <sql>WITH mud AS (SELECT recruitment_id,
                    MAX(execution_datetime) AS max_upd_date
             FROM etl.job_execution
             WHERE job_name = '${JOB_NAME}'
               AND status IN ('SUCCESS', 'DELTA_SUCCESS')
             GROUP BY recruitment_id)
SELECT r.idm_id
FROM ervu_dashboard.recruitment r
         JOIN mud ON mud.recruitment_id = r.idm_id
         JOIN ervu_dashboard.recruits_info ri
              ON COALESCE(ri.current_recruitment_id, ri.target_recruitment_id) = r.idm_id
                  AND ri.updated_at > mud.max_upd_date

union

select r2.idm_id
from ervu_dashboard.recruitment r2
         join etl.job_execution je
              on r2.idm_id = je.recruitment_id
where je.status in ('DELTA_ERROR', 'DELTA_PROCESSING')
  and je.job_name = '${JOB_NAME}';</sql>
    <variables_active>Y</variables_active>
    <attributes/>
    <GUI>
      <xloc>704</xloc>
      <yloc>496</yloc>
    </GUI>
  </transform>
  <transform>
    <name>get_max_source_update_date</name>
    <type>TableInput</type>
    <description/>
    <distribute>Y</distribute>
    <custom_distribution/>
    <copies>1</copies>
    <partitioning>
      <method>none</method>
      <schema_name/>
    </partitioning>
    <connection>ervu-dashboard</connection>
    <execute_each_row>N</execute_each_row>
    <limit>0</limit>
    <sql>WITH max_sport_elem_upd_date AS (
    SELECT max(source_update_date) AS dt FROM ervu_dashboard.sports_rank
    UNION
    SELECT max(source_update_date) FROM ervu_dashboard.sports_title
)
SELECT max(dt) AS max_source_update_date
FROM max_sport_elem_upd_date;</sql>
    <variables_active>N</variables_active>
    <attributes/>
    <GUI>
      <xloc>528</xloc>
      <yloc>496</yloc>
    </GUI>
  </transform>
  <transform>
    <name>sport_flow_delta.hpl</name>
    <type>PipelineExecutor</type>
    <description/>
    <distribute>Y</distribute>
    <custom_distribution/>
    <copies>1</copies>
    <partitioning>
      <method>none</method>
      <schema_name/>
    </partitioning>
    <run_configuration>local</run_configuration>
    <filename>${PROJECT_HOME}/info_recruits/citizen_tables/sport/parallel/sport_flow_delta.hpl</filename>
    <filenameInField>N</filenameInField>
    <filenameField/>
    <group_size>1</group_size>
    <group_field/>
    <group_time/>
    <parameters>
      <variable_mapping>
        <variable>IDM_ID</variable>
        <field>idm_id</field>
        <input/>
      </variable_mapping>
      <variable_mapping>
        <variable>MAX_SOURCE_UPDATE_DATE</variable>
        <field>max_source_update_date</field>
        <input/>
      </variable_mapping>
      <inherit_all_vars>Y</inherit_all_vars>
    </parameters>
    <execution_result_target_transform/>
    <execution_time_field>ExecutionTime</execution_time_field>
    <execution_result_field>ExecutionResult</execution_result_field>
    <execution_errors_field>ExecutionNrErrors</execution_errors_field>
    <execution_lines_read_field>ExecutionLinesRead</execution_lines_read_field>
    <execution_lines_written_field>ExecutionLinesWritten</execution_lines_written_field>
    <execution_lines_input_field>ExecutionLinesInput</execution_lines_input_field>
    <execution_lines_output_field>ExecutionLinesOutput</execution_lines_output_field>
    <execution_lines_rejected_field>ExecutionLinesRejected</execution_lines_rejected_field>
    <execution_lines_updated_field>ExecutionLinesUpdated</execution_lines_updated_field>
    <execution_lines_deleted_field>ExecutionLinesDeleted</execution_lines_deleted_field>
    <execution_files_retrieved_field>ExecutionFilesRetrieved</execution_files_retrieved_field>
    <execution_exit_status_field>ExecutionExitStatus</execution_exit_status_field>
    <execution_log_text_field>ExecutionLogText</execution_log_text_field>
    <execution_log_channelid_field>ExecutionLogChannelId</execution_log_channelid_field>
    <result_rows_target_transform/>
    <result_files_target_transform/>
    <result_files_file_name_field>FileName</result_files_file_name_field>
    <executors_output_transform/>
    <attributes/>
    <GUI>
      <xloc>896</xloc>
      <yloc>336</yloc>
    </GUI>
  </transform>
  <transform>
    <name>sport_flow_delta.hpl 2</name>
    <type>PipelineExecutor</type>
    <description/>
    <distribute>Y</distribute>
    <custom_distribution/>
    <copies>1</copies>
    <partitioning>
      <method>none</method>
      <schema_name/>
    </partitioning>
    <run_configuration>local</run_configuration>
    <filename>${PROJECT_HOME}/info_recruits/citizen_tables/sport/parallel/sport_flow_delta.hpl</filename>
    <filenameInField>N</filenameInField>
    <filenameField/>
    <group_size>1</group_size>
    <group_field/>
    <group_time/>
    <parameters>
      <variable_mapping>
        <variable>IDM_ID</variable>
        <field>idm_id</field>
        <input/>
      </variable_mapping>
      <variable_mapping>
        <variable>MAX_SOURCE_UPDATE_DATE</variable>
        <field>max_source_update_date</field>
        <input/>
      </variable_mapping>
      <inherit_all_vars>Y</inherit_all_vars>
    </parameters>
    <execution_result_target_transform/>
    <execution_time_field>ExecutionTime</execution_time_field>
    <execution_result_field>ExecutionResult</execution_result_field>
    <execution_errors_field>ExecutionNrErrors</execution_errors_field>
    <execution_lines_read_field>ExecutionLinesRead</execution_lines_read_field>
    <execution_lines_written_field>ExecutionLinesWritten</execution_lines_written_field>
    <execution_lines_input_field>ExecutionLinesInput</execution_lines_input_field>
    <execution_lines_output_field>ExecutionLinesOutput</execution_lines_output_field>
    <execution_lines_rejected_field>ExecutionLinesRejected</execution_lines_rejected_field>
    <execution_lines_updated_field>ExecutionLinesUpdated</execution_lines_updated_field>
    <execution_lines_deleted_field>ExecutionLinesDeleted</execution_lines_deleted_field>
    <execution_files_retrieved_field>ExecutionFilesRetrieved</execution_files_retrieved_field>
    <execution_exit_status_field>ExecutionExitStatus</execution_exit_status_field>
    <execution_log_text_field>ExecutionLogText</execution_log_text_field>
    <execution_log_channelid_field>ExecutionLogChannelId</execution_log_channelid_field>
    <result_rows_target_transform/>
    <result_files_target_transform/>
    <result_files_file_name_field>FileName</result_files_file_name_field>
    <executors_output_transform/>
    <attributes/>
    <GUI>
      <xloc>896</xloc>
      <yloc>416</yloc>
    </GUI>
  </transform>
  <transform>
    <name>sport_flow_delta.hpl 3</name>
    <type>PipelineExecutor</type>
    <description/>
    <distribute>Y</distribute>
    <custom_distribution/>
    <copies>1</copies>
    <partitioning>
      <method>none</method>
      <schema_name/>
    </partitioning>
    <run_configuration>local</run_configuration>
    <filename>${PROJECT_HOME}/info_recruits/citizen_tables/sport/parallel/sport_flow_delta.hpl</filename>
    <filenameInField>N</filenameInField>
    <filenameField/>
    <group_size>1</group_size>
    <group_field/>
    <group_time/>
    <parameters>
      <variable_mapping>
        <variable>IDM_ID</variable>
        <field>idm_id</field>
        <input/>
      </variable_mapping>
      <variable_mapping>
        <variable>MAX_SOURCE_UPDATE_DATE</variable>
        <field>max_source_update_date</field>
        <input/>
      </variable_mapping>
      <inherit_all_vars>Y</inherit_all_vars>
    </parameters>
    <execution_result_target_transform/>
    <execution_time_field>ExecutionTime</execution_time_field>
    <execution_result_field>ExecutionResult</execution_result_field>
    <execution_errors_field>ExecutionNrErrors</execution_errors_field>
    <execution_lines_read_field>ExecutionLinesRead</execution_lines_read_field>
    <execution_lines_written_field>ExecutionLinesWritten</execution_lines_written_field>
    <execution_lines_input_field>ExecutionLinesInput</execution_lines_input_field>
    <execution_lines_output_field>ExecutionLinesOutput</execution_lines_output_field>
    <execution_lines_rejected_field>ExecutionLinesRejected</execution_lines_rejected_field>
    <execution_lines_updated_field>ExecutionLinesUpdated</execution_lines_updated_field>
    <execution_lines_deleted_field>ExecutionLinesDeleted</execution_lines_deleted_field>
    <execution_files_retrieved_field>ExecutionFilesRetrieved</execution_files_retrieved_field>
    <execution_exit_status_field>ExecutionExitStatus</execution_exit_status_field>
    <execution_log_text_field>ExecutionLogText</execution_log_text_field>
    <execution_log_channelid_field>ExecutionLogChannelId</execution_log_channelid_field>
    <result_rows_target_transform/>
    <result_files_target_transform/>
    <result_files_file_name_field>FileName</result_files_file_name_field>
    <executors_output_transform/>
    <attributes/>
    <GUI>
      <xloc>896</xloc>
      <yloc>496</yloc>
    </GUI>
  </transform>
  <transform>
    <name>sport_flow_delta.hpl 4</name>
    <type>PipelineExecutor</type>
    <description/>
    <distribute>Y</distribute>
    <custom_distribution/>
    <copies>1</copies>
    <partitioning>
      <method>none</method>
      <schema_name/>
    </partitioning>
    <run_configuration>local</run_configuration>
    <filename>${PROJECT_HOME}/info_recruits/citizen_tables/sport/parallel/sport_flow_delta.hpl</filename>
    <filenameInField>N</filenameInField>
    <filenameField/>
    <group_size>1</group_size>
    <group_field/>
    <group_time/>
    <parameters>
      <variable_mapping>
        <variable>IDM_ID</variable>
        <field>idm_id</field>
        <input/>
      </variable_mapping>
      <variable_mapping>
        <variable>MAX_SOURCE_UPDATE_DATE</variable>
        <field>max_source_update_date</field>
        <input/>
      </variable_mapping>
      <inherit_all_vars>Y</inherit_all_vars>
    </parameters>
    <execution_result_target_transform/>
    <execution_time_field>ExecutionTime</execution_time_field>
    <execution_result_field>ExecutionResult</execution_result_field>
    <execution_errors_field>ExecutionNrErrors</execution_errors_field>
    <execution_lines_read_field>ExecutionLinesRead</execution_lines_read_field>
    <execution_lines_written_field>ExecutionLinesWritten</execution_lines_written_field>
    <execution_lines_input_field>ExecutionLinesInput</execution_lines_input_field>
    <execution_lines_output_field>ExecutionLinesOutput</execution_lines_output_field>
    <execution_lines_rejected_field>ExecutionLinesRejected</execution_lines_rejected_field>
    <execution_lines_updated_field>ExecutionLinesUpdated</execution_lines_updated_field>
    <execution_lines_deleted_field>ExecutionLinesDeleted</execution_lines_deleted_field>
    <execution_files_retrieved_field>ExecutionFilesRetrieved</execution_files_retrieved_field>
    <execution_exit_status_field>ExecutionExitStatus</execution_exit_status_field>
    <execution_log_text_field>ExecutionLogText</execution_log_text_field>
    <execution_log_channelid_field>ExecutionLogChannelId</execution_log_channelid_field>
    <result_rows_target_transform/>
    <result_files_target_transform/>
    <result_files_file_name_field>FileName</result_files_file_name_field>
    <executors_output_transform/>
    <attributes/>
    <GUI>
      <xloc>896</xloc>
      <yloc>576</yloc>
    </GUI>
  </transform>
  <transform>
    <name>sport_flow_delta.hpl 5</name>
    <type>PipelineExecutor</type>
    <description/>
    <distribute>Y</distribute>
    <custom_distribution/>
    <copies>1</copies>
    <partitioning>
      <method>none</method>
      <schema_name/>
    </partitioning>
    <run_configuration>local</run_configuration>
    <filename>${PROJECT_HOME}/info_recruits/citizen_tables/sport/parallel/sport_flow_delta.hpl</filename>
    <filenameInField>N</filenameInField>
    <filenameField/>
    <group_size>1</group_size>
    <group_field/>
    <group_time/>
    <parameters>
      <variable_mapping>
        <variable>IDM_ID</variable>
        <field>idm_id</field>
        <input/>
      </variable_mapping>
      <variable_mapping>
        <variable>MAX_SOURCE_UPDATE_DATE</variable>
        <field>max_source_update_date</field>
        <input/>
      </variable_mapping>
      <inherit_all_vars>Y</inherit_all_vars>
    </parameters>
    <execution_result_target_transform/>
    <execution_time_field>ExecutionTime</execution_time_field>
    <execution_result_field>ExecutionResult</execution_result_field>
    <execution_errors_field>ExecutionNrErrors</execution_errors_field>
    <execution_lines_read_field>ExecutionLinesRead</execution_lines_read_field>
    <execution_lines_written_field>ExecutionLinesWritten</execution_lines_written_field>
    <execution_lines_input_field>ExecutionLinesInput</execution_lines_input_field>
    <execution_lines_output_field>ExecutionLinesOutput</execution_lines_output_field>
    <execution_lines_rejected_field>ExecutionLinesRejected</execution_lines_rejected_field>
    <execution_lines_updated_field>ExecutionLinesUpdated</execution_lines_updated_field>
    <execution_lines_deleted_field>ExecutionLinesDeleted</execution_lines_deleted_field>
    <execution_files_retrieved_field>ExecutionFilesRetrieved</execution_files_retrieved_field>
    <execution_exit_status_field>ExecutionExitStatus</execution_exit_status_field>
    <execution_log_text_field>ExecutionLogText</execution_log_text_field>
    <execution_log_channelid_field>ExecutionLogChannelId</execution_log_channelid_field>
    <result_rows_target_transform/>
    <result_files_target_transform/>
    <result_files_file_name_field>FileName</result_files_file_name_field>
    <executors_output_transform/>
    <attributes/>
    <GUI>
      <xloc>896</xloc>
      <yloc>656</yloc>
    </GUI>
  </transform>
  <transform_error_handling>
  </transform_error_handling>
  <attributes/>
</pipeline>
