Uploaded image for project: 'Apache Lens (Retired)'
  1. Apache Lens (Retired)
  2. LENS-1452

Optimize Time Union candidate Algorithm

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • cube
    • None

    Description

      Current algorithm:

      • Create bitmap (equivalent to powerset)
      • from the powerset, add sets which can complete all time ranges as candidates
      • Prune sets which are contained in other sets

      Proposed change:

      The following recursion implemented iteratively:

          (ignoring cubeql for clarity)
          getCombinations(candidates) = getCombinationsRecursive(emptyList(), candidates)
          getCombinationsRecursive(incompleteCombinations: List<List<Candidate>>, candidates: List<Candidate>) =
          head, tail = head and tail of linked List candidates
          add head to all elements of incompleteCombinations.
          add {{ [head] }} as one incompleteCombination.
          complete = remove now complete combinations from incompleteCombinations
          return {{complete ++ getCombinationsTailRecursive(incompleteCombinations+[head], tail)}}
      

      The improvement is, that redundant union candidates like

      {a,b,c}

      won't be generated if

      {a,b}

      is already covering time ranges. This will only generate minimal sets that cover time ranges. So the memory footprint isn't O( 2^n ) anymore.

      Attachments

        1. LENS-1452.01.patch
          4 kB
          Rajat Khandelwal

        Activity

          People

            prongs Rajat Khandelwal
            prongs Rajat Khandelwal
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: