sc/source/core/data/queryiter.cxx |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 02b4d5027b0a48c192ce2bf35c69abe347eb3601
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Wed Apr 26 21:11:44 2023 +0200
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Apr 27 16:58:55 2023 +0200

    Resolves: tdf#151958 Disable binary search on sorted cache for current 
releases
    
    Temporary measure until the actual cause is fixed.
    The by string query of binary search on sorted cache is broken for
    mixed types like here the numeric date cells and text cells.
    
    Change-Id: Icfe0b0c30987fcefdd6ed11066ea9113f3b4dabe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151074
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit cf3fcb875ecfe47940347286e869b3909ed42274)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151025
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/core/data/queryiter.cxx 
b/sc/source/core/data/queryiter.cxx
index 5d8a3695f7d1..1fbdb526bc0f 100644
--- a/sc/source/core/data/queryiter.cxx
+++ b/sc/source/core/data/queryiter.cxx
@@ -1219,10 +1219,21 @@ ScQueryCellIteratorAccessSpecific< 
ScQueryCellIteratorAccess::SortedCache >::Mak
     return SortedCacheIndexer(rCells, nStartRow, nEndRow, sortedCache);
 }
 
-static bool CanBeUsedForSorterCache(ScDocument& rDoc, const ScQueryParam& 
rParam,
-    SCTAB nTab, const ScFormulaCell* cell, const ScComplexRefData* refData,
-    ScInterpreterContext& context)
+static bool CanBeUsedForSorterCache(ScDocument& /*rDoc*/, const ScQueryParam& 
/*rParam*/,
+    SCTAB /*nTab*/, const ScFormulaCell* /*cell*/, const ScComplexRefData* 
/*refData*/,
+    ScInterpreterContext& /*context*/)
 {
+#if 1
+    /* TODO: tdf#151958 broken by string query of binary search on sorted
+     * cache, use the direct query instead for releases and fix SortedCache
+     * implementation after. Not only COUNTIF() is broken, but also COUNTIFS(),
+     * and maybe lcl_LookupQuery() for VLOOKUP() etc. as well. Just disable
+     * this for now.
+     * Can't just return false because below would be unreachable code. Can't
+     * just #if/#else/#endif either because parameters would be unused. Crap
+     * this and comment out parameter names. */
+    return false;
+#else
     if(!rParam.GetEntry(0).bDoQuery || rParam.GetEntry(1).bDoQuery
         || rParam.GetEntry(0).GetQueryItems().size() != 1 )
         return false;
@@ -1278,6 +1289,7 @@ static bool CanBeUsedForSorterCache(ScDocument& rDoc, 
const ScQueryParam& rParam
             return false;
     }
     return true;
+#endif
 }
 
 // Generic query implementation.

Reply via email to