Skip to content

SpelCompiler is unable to compile too often #23963

Closed
@tonyschwartz

Description

@tonyschwartz

I need to allow allow a user to build an expression that will be used to evaluate a boolean result against millions of records per second, so I need to ensure the expression is compiled. There is an apparent problem with the way the spring expression framework attempts to compile the expression.

Let's say I have this expression: productType == 'Firewall' and categoryId == 400

The issue is: If the first 100 records that are sent through this expression never contain productType="Firewall", then categoryId is never evaluated by the parser due to short-circuiting of the boolean "and" operator. Deep in the code, in PropertyOrFieldReference, this.cachedReadAccessor is always null for the categoryId field. Because of this, the spring expression parser will never be able to compile this expression.

Does anyone have any recommendations for me?

I'd like to use this framework for this use case, but I need to ensure these expressions are compiled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions