Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(formula): wildcard compare not apply cache (#6162)

Univerdcb99f8d4317
diff --git a/packages/engine-formula/src/engine/value-object/array-value-object.ts b/packages/engine-formula/src/engine/value-object/array-value-object.ts
index a9da0bfc74..05097fae4b 100644
--- a/packages/engine-formula/src/engine/value-object/array-value-object.ts
+++ b/packages/engine-formula/src/engine/value-object/array-value-object.ts
@@ -23,7 +23,7 @@ import { ERROR_TYPE_SET, ErrorType } from '../../basics/error-type';
import { CELL_INVERTED_INDEX_CACHE, DEFAULT_EMPTY_CELL_KEY } from '../../basics/inverted-index-cache';
import { regexTestArrayValue } from '../../basics/regex';
import { compareToken } from '../../basics/token';
-import { ArrayBinarySearchType, ArrayOrderSearchType, getCompare } from '../utils/compare';
+import { ArrayBinarySearchType, ArrayOrderSearchType, getCompare, isWildcard } from '../utils/compare';
import { stringIsNumberPattern } from '../utils/numfmt-kit';
import { BaseValueObject, ErrorValueObject } from './base-value-object';
import { BooleanValueObject, createBooleanValueObjectByRawValue, createNumberValueObjectByRawValue, createStringValueObjectByRawValue, NullValueObject, NumberValueObject, StringValueObject } from './primitive-object';
@@ -1523,7 +1523,7 @@ export class ArrayValueObject extends BaseValueObject {
);
if (rowsInCache.length > 0) {
- if (operator === compareToken.EQUALS) {
+ if (operator === compareToken.EQUALS && !(valueObject.isString() && isWildcard(valueObject.getValue() as string))) {
// TODO@DR-Univer: When comparing equal with two parameters, one of them is error, and the logic here is wrong
const rowPositions = CELL_INVERTED_INDEX_CACHE.getCellPositions(
unitId,