This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/master by this push:
new 50c2f0994b dynamic sql row and detect empty stream samples #2237
new 990dfc2cac Merge pull request #2439 from bamaer/2237
50c2f0994b is described below
commit 50c2f0994bc30e45a092231be7dae1891d7d8e9a
Author: Bart Maertens <[email protected]>
AuthorDate: Sun Feb 19 10:58:17 2023 +0100
dynamic sql row and detect empty stream samples #2237
---
.../transforms/detect-empty-stream-basic.hpl | 149 ++++++++++
.../main/samples/transforms/dynamic-sql-row.hpl | 315 +++++++++++++++++++++
2 files changed, 464 insertions(+)
diff --git
a/plugins/transforms/detectemptystream/src/main/samples/transforms/detect-empty-stream-basic.hpl
b/plugins/transforms/detectemptystream/src/main/samples/transforms/detect-empty-stream-basic.hpl
new file mode 100644
index 0000000000..d74522c937
--- /dev/null
+++
b/plugins/transforms/detectemptystream/src/main/samples/transforms/detect-empty-stream-basic.hpl
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<pipeline>
+ <info>
+ <name>detect-empty-stream-basic</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>2023/02/14 20:11:35.766</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2023/02/14 20:11:35.766</modified_date>
+ </info>
+ <notepads>
+ <notepad>
+ <backgroundcolorblue>251</backgroundcolorblue>
+ <backgroundcolorgreen>232</backgroundcolorgreen>
+ <backgroundcolorred>201</backgroundcolorred>
+ <bordercolorblue>90</bordercolorblue>
+ <bordercolorgreen>58</bordercolorgreen>
+ <bordercolorred>14</bordercolorred>
+ <fontbold>N</fontbold>
+ <fontcolorblue>90</fontcolorblue>
+ <fontcolorgreen>58</fontcolorgreen>
+ <fontcolorred>14</fontcolorred>
+ <fontitalic>N</fontitalic>
+ <fontname>Noto Sans</fontname>
+ <fontsize>10</fontsize>
+ <height>61</height>
+ <xloc>226</xloc>
+ <yloc>130</yloc>
+ <note>the "Detect empty stream" transform checks if the stream is empty.
+If it is, a single line with the correct stream layout and null values is
generated.
+</note>
+ <width>444</width>
+ </notepad>
+ </notepads>
+ <order>
+ <hop>
+ <from>detect empty stream</from>
+ <to>Dummy (do nothing)</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>get empty file list</from>
+ <to>detect empty stream</to>
+ <enabled>Y</enabled>
+ </hop>
+ </order>
+ <transform>
+ <name>detect empty stream</name>
+ <type>DetectEmptyStream</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <attributes/>
+ <GUI>
+ <xloc>400</xloc>
+ <yloc>208</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>Dummy (do nothing)</name>
+ <type>Dummy</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <attributes/>
+ <GUI>
+ <xloc>624</xloc>
+ <yloc>208</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>get empty file list</name>
+ <type>GetFileNames</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <doNotFailIfNoFile>N</doNotFailIfNoFile>
+ <dynamic_include_subfolders>N</dynamic_include_subfolders>
+ <exclude_wildcard_Field/>
+ <file>
+ <exclude_filemask/>
+ <file_required>N</file_required>
+ <filemask/>
+ <include_subfolders>N</include_subfolders>
+ <name>${PROJECT_HOME}/no-such-file.txt</name>
+ </file>
+ <filefield>N</filefield>
+ <filename_Field/>
+ <filter>
+ <filterfiletype>all_files</filterfiletype>
+ </filter>
+ <isaddresult>Y</isaddresult>
+ <limit>0</limit>
+ <raiseAnExceptionIfNoFile>N</raiseAnExceptionIfNoFile>
+ <rownum>N</rownum>
+ <rownum_field/>
+ <wildcard_Field/>
+ <attributes/>
+ <GUI>
+ <xloc>176</xloc>
+ <yloc>208</yloc>
+ </GUI>
+ </transform>
+ <transform_error_handling>
+ </transform_error_handling>
+ <attributes/>
+</pipeline>
diff --git
a/plugins/transforms/dynamicsqlrow/src/main/samples/transforms/dynamic-sql-row.hpl
b/plugins/transforms/dynamicsqlrow/src/main/samples/transforms/dynamic-sql-row.hpl
new file mode 100644
index 0000000000..c16eb556fc
--- /dev/null
+++
b/plugins/transforms/dynamicsqlrow/src/main/samples/transforms/dynamic-sql-row.hpl
@@ -0,0 +1,315 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<pipeline>
+ <info>
+ <name>dynamic-sql-row</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>2023/02/14 20:20:51.940</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2023/02/14 20:20:51.940</modified_date>
+ </info>
+ <notepads>
+ </notepads>
+ <order>
+ <hop>
+ <from>get initial row_count</from>
+ <to>add 4 rows</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>add 4 rows</from>
+ <to>add counter</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>add counter</from>
+ <to>get sydate</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>get sydate</from>
+ <to>sysdate to string</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>sysdate to string</from>
+ <to>build sql</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>build sql</from>
+ <to>Dynamic SQL row</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>Dynamic SQL row</from>
+ <to>get final row_count</to>
+ <enabled>Y</enabled>
+ </hop>
+ </order>
+ <transform>
+ <name>Dynamic SQL row</name>
+ <type>DynamicSqlRow</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <connection>hop-samples</connection>
+ <outer_join>N</outer_join>
+ <query_only_on_change>N</query_only_on_change>
+ <replace_vars>N</replace_vars>
+ <rowlimit>0</rowlimit>
+ <sql>insert into PUBLIC.TABLEINPUT values (10, 'N', 'Value 10',
'2023-02-14 20:34:26');</sql>
+ <sql_fieldname>sql</sql_fieldname>
+ <attributes/>
+ <GUI>
+ <xloc>848</xloc>
+ <yloc>224</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>add 4 rows</name>
+ <type>CloneRow</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <addcloneflag>N</addcloneflag>
+ <addclonenum>N</addclonenum>
+ <nrclonefield>ROW_COUNT</nrclonefield>
+ <nrcloneinfield>N</nrcloneinfield>
+ <nrclones>4</nrclones>
+ <attributes/>
+ <GUI>
+ <xloc>256</xloc>
+ <yloc>112</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>add counter</name>
+ <type>Sequence</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <connection>hop-samples</connection>
+ <increment_by>1</increment_by>
+ <max_value>999999999</max_value>
+ <seqname>SEQ_</seqname>
+ <start_at>1</start_at>
+ <use_counter>Y</use_counter>
+ <use_database>N</use_database>
+ <valuename>counter</valuename>
+ <attributes/>
+ <GUI>
+ <xloc>400</xloc>
+ <yloc>112</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>build sql</name>
+ <type>ScriptValueMod</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <optimizationLevel>9</optimizationLevel>
+ <jsScripts>
+ <jsScript>
+ <jsScript_type>0</jsScript_type>
+ <jsScript_name>Script 1</jsScript_name>
+ <jsScript_script>//Script here
+
+var id = ROW_COUNT + counter;
+var sql = "insert into PUBLIC.TABLEINPUT values (" + id + ", 'N', 'Value " +
id + "', '" + sysdate + "');"; </jsScript_script>
+ </jsScript>
+ </jsScripts>
+ <fields>
+ <field>
+ <name>sql</name>
+ <rename>sql</rename>
+ <type>String</type>
+ <length>-1</length>
+ <precision>-1</precision>
+ <replace>N</replace>
+ </field>
+ </fields>
+ <attributes/>
+ <GUI>
+ <xloc>848</xloc>
+ <yloc>112</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>get final row_count</name>
+ <type>TableInput</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <connection>hop-samples</connection>
+ <execute_each_row>N</execute_each_row>
+ <limit>0</limit>
+ <sql>SELECT count(*) as row_count
+FROM PUBLIC.TABLEINPUT
+</sql>
+ <variables_active>N</variables_active>
+ <attributes/>
+ <GUI>
+ <xloc>1040</xloc>
+ <yloc>224</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>get initial row_count</name>
+ <type>TableInput</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <connection>hop-samples</connection>
+ <execute_each_row>N</execute_each_row>
+ <limit>0</limit>
+ <sql>SELECT count(*) as row_count
+FROM PUBLIC.TABLEINPUT
+</sql>
+ <variables_active>N</variables_active>
+ <attributes/>
+ <GUI>
+ <xloc>112</xloc>
+ <yloc>112</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>get sydate</name>
+ <type>SystemInfo</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <fields>
+ <field>
+ <name>sysdate</name>
+ <type>system date (variable)</type>
+ </field>
+ </fields>
+ <attributes/>
+ <GUI>
+ <xloc>560</xloc>
+ <yloc>112</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>sysdate to string</name>
+ <type>SelectValues</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <fields>
+ <select_unspecified>N</select_unspecified>
+ <meta>
+ <name>sysdate</name>
+ <rename>sysdate</rename>
+ <type>String</type>
+ <length>-2</length>
+ <precision>-2</precision>
+ <conversion_mask>yyyy-MM-dd HH:mm:ss</conversion_mask>
+ <date_format_lenient>false</date_format_lenient>
+ <date_format_locale/>
+ <date_format_timezone/>
+ <lenient_string_to_number>false</lenient_string_to_number>
+ <encoding/>
+ <decimal_symbol/>
+ <grouping_symbol/>
+ <currency_symbol/>
+ <storage_type/>
+ </meta>
+ </fields>
+ <attributes/>
+ <GUI>
+ <xloc>704</xloc>
+ <yloc>112</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>Calculator</name>
+ <type>Calculator</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <failIfNoFile>Y</failIfNoFile>
+ <attributes/>
+ <GUI>
+ <xloc>272</xloc>
+ <yloc>288</yloc>
+ </GUI>
+ </transform>
+ <transform_error_handling>
+ </transform_error_handling>
+ <attributes/>
+</pipeline>