Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2935

Add BOOL_OR, BOOL_AND, LOGICAL_OR, LOGICAL_AND aggregate functions

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.27.0
    • core

    Description

      Support ANY, SOME, EVERY (also known as BOOL_OR, BOOL_AND) aggregate functions.

      ANY, SOME is equivalent with bool_or. EVERY is equivalent with bool_and. Parser needs to be changed to support these aggregate functions.

      https://blog.jooq.org/2014/12/18/a-true-sql-gem-you-didnt-know-yet-the-every-aggregate-function/
      https://mysqlserverteam.com/using-the-aggregate-functions-any-some-every-with-mysql/

      Note that if ANY or SOME aggregate function is placed on the right side of comparison operation and argument of this function is a subquery additional parentheses around aggregate function are required, otherwise it will be parsed as quantified comparison predicate.

      Example:

      ANY(NAME LIKE 'W%')
      A = (ANY((SELECT B FROM T)))

      Attachments

        Issue Links

          Activity

            People

              julianhyde Julian Hyde
              hyuan Haisheng Yuan
              Votes:
              0 Vote for this issue
              Watchers:
              5 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 - 3.5h
                  3.5h