[ 
https://issues.apache.org/jira/browse/NIFI-16429?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Stieglitz reassigned NIFI-16429:
---------------------------------------

    Assignee: Daniel Stieglitz

> ExcelReader - "Use Starting Row" strategy doesn't evaluate formulas for 
> Header Row
> ----------------------------------------------------------------------------------
>
>                 Key: NIFI-16429
>                 URL: https://issues.apache.org/jira/browse/NIFI-16429
>             Project: Apache NiFi
>          Issue Type: Bug
>            Reporter: Philipp Korniets
>            Assignee: Daniel Stieglitz
>            Priority: Major
>         Attachments: test_book.xlsx
>
>
> When processing this workbook, header in Second Sheet contains formula.
> ="value_in_"&'First Sheet'!B1
> Previously, ConvertExcelToCSV was returning last cached value. However in new 
> ExcelReader value comes from DataFormatter and not from getCellValue() for 
> strategy  *Use Starting Row*
> So the result looks wrong i think
> {code:java}
> test_col1,"\"value_in_\"&'First Sheet'!B1",test_col3{code}
> AI details:
> *{{ExcelReader.java}}* ({{{}getSchemaAccessStrategy{}}}, about lines 
> 177–186): for "Use Starting Row" it builds {{{}new 
> ExcelStartingRowSchemaInference(...){}}}.
>  
> java
> {code:java}
> if 
> (ExcelStartingRowSchemaInference.USE_STARTING_ROW.getValue().equals(allowableValue))
>  {
>     ...
>     final SchemaInferenceEngine<Row> inference =
>             new ExcelStartingRowSchemaInference(rowEvaluationStrategy, 
> firstRow, createTimeValueInference());
>     return createInferSchemaAccessStrategy(context, inference); {code}
> *{{{}ExcelStartingRowSchemaInference.java{}}}:*
> ||Approx. line||Code||
> |52|{{private final DataFormatter dataFormatter;}}|
> |58|{{this.dataFormatter = new DataFormatter();}} (constructor, plain, no 
> evaluator, no {{{}setUseCachedValuesForFormulaCells{}}})|
> |71|{{fieldNames = getFieldNames(firstRow, row);}} (in {{{}inferSchema{}}}, 
> when {{{}index == 0{}}})|
> |*103*|*{{final String fieldName = dataFormatter.formatCellValue(cell);}}* 
> (in {{{}getFieldNames{}}})|
> Line 103 is the one that returns the formula text on POI 5.x. The header row 
> is the first row the inference loop reads, so {{getFieldNames()}} gets it at 
> line 71.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to