Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-5521

N1QL Parser has exponential slowdown for redundant parentheses

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.1.7
    • Beryllium, 3.0.18, 3.1.7
    • LiteCore
    • Security Level: Public
    • None
    • 1

    Description

      A query like `SELECT * FROM _ WHERE (((((type == "6")))))` should be the same as `SELECT * FROM _ WHERE (type == "6")`. But the N1QL parser creates a new expression for every parentheses. Because the parser acts recursively, this can cause exponential slowdown. We should strip the redundant parentheses at the top-level, to avoid creating unnecessary expressions.
      We must be careful not to remove all parentheses.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              callum.birks Callum Birks
              callum.birks Callum Birks
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty