Skip to content

Commit

Permalink
support for formula types. fixes #3670
Browse files Browse the repository at this point in the history
  • Loading branch information
bamaer committed Feb 27, 2024
1 parent 1a7a84b commit fd2b3f8
Show file tree
Hide file tree
Showing 4 changed files with 324 additions and 0 deletions.
227 changes: 227 additions & 0 deletions integration-tests/transforms/0070-excel-input-formula-3670.hpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
<?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>0070-excel-input-formula-3670</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>2024/02/22 12:13:59.927</created_date>
<modified_user>-</modified_user>
<modified_date>2024/02/22 12:13:59.927</modified_date>
</info>
<notepads>
</notepads>
<order>
<hop>
<from>read xlsx with formulas</from>
<to>preview</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>preview</name>
<type>Dummy</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<attributes/>
<GUI>
<xloc>432</xloc>
<yloc>144</yloc>
</GUI>
</transform>
<transform>
<name>read xlsx with formulas</name>
<type>ExcelInput</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<accept_field/>
<accept_filenames>N</accept_filenames>
<accept_transform_name/>
<add_to_result_filenames>Y</add_to_result_filenames>
<bad_line_files_destination_directory/>
<bad_line_files_extension>warning</bad_line_files_extension>
<encoding>Big5</encoding>
<error_ignored>N</error_ignored>
<error_line_files_destination_directory/>
<error_line_files_extension>error</error_line_files_extension>
<error_line_skipped>N</error_line_skipped>
<extensionFieldName/>
<fields>
<field>
<currency/>
<decimal/>
<format/>
<group/>
<length>-1</length>
<name>Year</name>
<precision>-1</precision>
<repeat>N</repeat>
<trim_type>none</trim_type>
<type>String</type>
</field>
<field>
<currency/>
<decimal/>
<format/>
<group/>
<length>-1</length>
<name>Revision</name>
<precision>-1</precision>
<repeat>N</repeat>
<trim_type>none</trim_type>
<type>String</type>
</field>
<field>
<currency/>
<decimal/>
<format/>
<group/>
<length>-1</length>
<name>Account_Code</name>
<precision>-1</precision>
<repeat>N</repeat>
<trim_type>none</trim_type>
<type>String</type>
</field>
<field>
<currency/>
<decimal/>
<format/>
<group/>
<length>-1</length>
<name>Account_Name</name>
<precision>-1</precision>
<repeat>N</repeat>
<trim_type>none</trim_type>
<type>String</type>
</field>
<field>
<currency/>
<decimal/>
<format/>
<group/>
<length>-1</length>
<name>Formula Number</name>
<precision>-1</precision>
<repeat>N</repeat>
<trim_type>none</trim_type>
<type>Number</type>
</field>
<field>
<currency/>
<decimal/>
<format/>
<group/>
<length>-1</length>
<name>Formula Date</name>
<precision>-1</precision>
<repeat>N</repeat>
<trim_type>none</trim_type>
<type>Date</type>
</field>
<field>
<currency/>
<decimal/>
<format/>
<group/>
<length>-1</length>
<name>Formula String</name>
<precision>-1</precision>
<repeat>N</repeat>
<trim_type>none</trim_type>
<type>String</type>
</field>
<field>
<currency/>
<decimal/>
<format/>
<group/>
<length>-1</length>
<name>Formula Boolean</name>
<precision>-1</precision>
<repeat>N</repeat>
<trim_type>none</trim_type>
<type>Boolean</type>
</field>
</fields>
<file>
<exclude_filemask/>
<file_required>N</file_required>
<filemask/>
<include_subfolders>N</include_subfolders>
<name>${PROJECT_HOME}/files/sample_file_with_formulas.xlsx</name>
</file>
<filefield/>
<header>Y</header>
<hiddenFieldName/>
<lastModificationTimeFieldName/>
<limit>0</limit>
<line_number_files_destination_directory/>
<line_number_files_extension>line</line_number_files_extension>
<noempty>Y</noempty>
<pathFieldName/>
<rootUriNameFieldName/>
<rownumfield/>
<sheetfield/>
<sheetrownumfield/>
<sheets>
<sheet>
<name>Budget NEW</name>
<startcol>0</startcol>
<startrow>0</startrow>
</sheet>
</sheets>
<shortFileFieldName/>
<sizeFieldName/>
<spreadsheet_type>POI</spreadsheet_type>
<stoponempty>N</stoponempty>
<strict_types>Y</strict_types>
<uriNameFieldName/>
<attributes/>
<GUI>
<xloc>208</xloc>
<yloc>144</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>
</pipeline>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?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.
-->
<workflow>
<name>main-0070-excel-input-formulas-3670</name>
<name_sync_with_filename>Y</name_sync_with_filename>
<description/>
<extended_description/>
<workflow_version/>
<created_user>-</created_user>
<created_date>2024/02/27 20:06:49.430</created_date>
<modified_user>-</modified_user>
<modified_date>2024/02/27 20:06:49.430</modified_date>
<parameters>
</parameters>
<actions>
<action>
<name>Start</name>
<description/>
<type>SPECIAL</type>
<attributes/>
<DayOfMonth>1</DayOfMonth>
<hour>12</hour>
<intervalMinutes>60</intervalMinutes>
<intervalSeconds>0</intervalSeconds>
<minutes>0</minutes>
<repeat>N</repeat>
<schedulerType>0</schedulerType>
<weekDay>1</weekDay>
<parallel>N</parallel>
<xloc>50</xloc>
<yloc>50</yloc>
<attributes_hac/>
</action>
<action>
<name>0070-excel-input-formula-3670.hpl</name>
<description/>
<type>PIPELINE</type>
<attributes/>
<add_date>N</add_date>
<add_time>N</add_time>
<clear_files>N</clear_files>
<clear_rows>N</clear_rows>
<create_parent_folder>N</create_parent_folder>
<exec_per_row>N</exec_per_row>
<filename>${PROJECT_HOME}/0070-excel-input-formula-3670.hpl</filename>
<logext/>
<logfile/>
<loglevel>Basic</loglevel>
<parameters>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
<params_from_previous>N</params_from_previous>
<run_configuration>local</run_configuration>
<set_append_logfile>N</set_append_logfile>
<set_logfile>N</set_logfile>
<wait_until_finished>Y</wait_until_finished>
<parallel>N</parallel>
<xloc>272</xloc>
<yloc>48</yloc>
<attributes_hac/>
</action>
</actions>
<hops>
<hop>
<from>Start</from>
<to>0070-excel-input-formula-3670.hpl</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>Y</unconditional>
</hop>
</hops>
<notepads>
</notepads>
<attributes/>
</workflow>
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ private void checkType(IKCell cell, IValueMeta v) throws HopException {
}
switch (cell.getType()) {
case BOOLEAN:
case BOOLEAN_FORMULA:
if (!(v.getType() == IValueMeta.TYPE_STRING
|| v.getType() == IValueMeta.TYPE_NONE
|| v.getType() == IValueMeta.TYPE_BOOLEAN)) {
Expand All @@ -327,6 +328,7 @@ private void checkType(IKCell cell, IValueMeta v) throws HopException {
break;

case DATE:
case DATE_FORMULA:
if (!(v.getType() == IValueMeta.TYPE_STRING
|| v.getType() == IValueMeta.TYPE_NONE
|| v.getType() == IValueMeta.TYPE_DATE)) {
Expand All @@ -340,6 +342,7 @@ private void checkType(IKCell cell, IValueMeta v) throws HopException {
break;

case LABEL:
case STRING_FORMULA:
if (v.getType() == IValueMeta.TYPE_BOOLEAN
|| v.getType() == IValueMeta.TYPE_DATE
|| v.getType() == IValueMeta.TYPE_INTEGER
Expand All @@ -358,6 +361,7 @@ private void checkType(IKCell cell, IValueMeta v) throws HopException {
break;

case NUMBER:
case NUMBER_FORMULA:
if (!(v.getType() == IValueMeta.TYPE_STRING
|| v.getType() == IValueMeta.TYPE_NONE
|| v.getType() == IValueMeta.TYPE_INTEGER
Expand All @@ -372,6 +376,7 @@ private void checkType(IKCell cell, IValueMeta v) throws HopException {
}
break;


default:
throw new HopException(
BaseMessages.getString(
Expand Down

0 comments on commit fd2b3f8

Please sign in to comment.