Bug 61063 - Use of arrays of values leads to non empty stack
Summary: Use of arrays of values leads to non empty stack
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 3.16-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2017-05-03 13:40 UTC by Mathis
Modified: 2017-05-23 22:14 UTC (History)
0 users

Very simple example with rank function (8.94 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2017-05-03 13:40 UTC, Mathis

Note You need to log in before you can comment on or make changes to this bug.
Description Mathis 2017-05-03 13:40:05 UTC
Created attachment 34971 [details]
Very simple example with rank function

When a cell contains a formula with an array of values, the evaluation of the cell is not completed and an exception is thrown.

Here is an example formula: =RANK(A3;(B1;B4;B6);1) (Please see attachment)

Exception in thread "main" java.lang.IllegalStateException: evaluation stack not empty
	at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:539)
	at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:290)
	at org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:232)
	at org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator.evaluateFormulaCellValue(BaseXSSFFormulaEvaluator.java:65)
	at org.apache.poi.ss.formula.BaseFormulaEvaluator.evaluate(BaseFormulaEvaluator.java:101)
Comment 1 Dominik Stadler 2017-05-22 20:47:37 UTC
Initial assessment: The list of values as 2nd argument is not supported right now and thus leads to this exception. We likely need some new handling of the resulting UnionPtgs in WorkbookEvaluator.evaluateFormula()
Comment 2 Dominik Stadler 2017-05-23 22:14:11 UTC
This should be fixed in r1795963, there may be other functions where this is not yet fully supported, but I could not yet find a description of where else it is possible to specify a list of references, if you happen to find one, please open a separate bug so we can try to implement it there as well.