Uploaded image for project: 'Apache AsterixDB'
  1. Apache AsterixDB
  2. ASTERIXDB-2834

Recognize Applicable Nested Universal Quantification Queries for Array Indexes

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • IDX - Indexes
    • None

    Description

      Currently users can utilize array indexes w/ array depth > 1 for only existential quantification and explicit unnest queries, but not for universal quantification clauses that aren't at the top-level. 

       

      For example, the query below is optimized because the universal quantification is the outermost quantification:

       

      SELECT C.business_id
      FROM YelpCheckin C
      WHERE LEN(C.checkin_times) > 0 AND
            (EVERY CT IN C.checkin_times
             SATISFIES (
                 SOME D IN CT.dates
                 SATISFIES "2019-06-07" = D
            ));
      

      But if we switch the "EVERY" and "SOME", then the query is not optimized (even though we can). Here, the universal quantification is on an array that isn't at the "top-level".

       

      SELECT C.business_id
      FROM YelpCheckin C
      WHERE LEN(C.checkin_times) > 0 AND
            (SOME CT IN C.checkin_times
             SATISFIES (
                 EVERY D IN CT.dates
                 SATISFIES "2019-06-07" = D
            ));
      

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            ggalvizo Glenn Justo Galvizo
            ggalvizo Glenn Justo Galvizo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment