Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-8574

ExpressionFunctionValues should cache per-hit value

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 7.5, 8.0
    • 9.0, 8.7
    • None
    • None
    • New

    Description

      The original version of ExpressionFunctionValues had a simple per-hit cache, so that nested expressions that reference the same common variable would compute the value for that variable the first time it was referenced and then use that cached value for all subsequent invocations, within one hit.  I think it was accidentally removed in LUCENE-7609?

      This is quite important if you have non-trivial expressions that reference the same variable multiple times.

      E.g. if I have these expressions:

      x = c + d
      c = b + 2 
      d = b * 2

      Then evaluating x should only cause b's value to be computed once (for a given hit), but today it's computed twice.  The problem is combinatoric if b then references another variable multiple times, etc.

      I think to fix this we just need to restore the per-hit cache?

       

      Attachments

        1. unit_test.patch
          3 kB
          Patrick Zhai
        2. LUCENE-8574.patch
          1 kB
          Robert Muir

        Issue Links

          Activity

            People

              rcmuir Robert Muir
              mikemccand Michael McCandless
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h 20m
                  3h 20m