fix ByValue lookups with ScSortedRangeCache

Desktop / LibreOffice - Luboš Luňák [] - 26 June 2022 18:27 UTC

My fix for tdf#149071 actually disabled the optimization for all ByValue lookups, because in fact all such lookups have maString set. So lookups where the cells are a mix of numeric and string values need different handling. A simple solution is detecting such a mix when collecting the values for ScSortedRangeCache and disabling the optimization in such a case. But it turns out that queries containing such a mix are not that rare, as documents may e.g. do COUNTIF($C:$C) where the given column has numeric values that start with a textual header. So bail out only if the string cell actually could affect the numeric query. Also fix ScSortedRangeCache usage depending on query parameters, different instances are needed for e.g. different ScQueryOp, because the ScQueryEvaluator functions may return different results (isQueryByString() is automatically true for SC_EQUAL).

Change-Id: Ib4565cbf6194e7c525c4d10d00b1c31707952a79 Reviewed-on:

423f277cc0c1 fix ByValue lookups with ScSortedRangeCache
sc/inc/queryevaluator.hxx | 16 +-
sc/inc/queryiter.hxx | 10 +-
sc/inc/rangecache.hxx | 26 +-
.../data/functions/statistical/fods/countif.fods | 191 +-
.../data/functions/statistical/fods/countif2.fods | 3157 ++++++++++++++++++++
sc/source/core/data/queryevaluator.cxx | 57 +-
sc/source/core/data/queryiter.cxx | 37 +-
sc/source/core/tool/interpr1.cxx | 8 +-
sc/source/core/tool/rangecache.cxx | 69 +-
9 files changed, 3411 insertions(+), 160 deletions(-)


  • Share