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

Add EXISTS function (enabled in Spark library)

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.36.0
    • 1.37.0
    • core

    Description

      exists(expr, pred) - Tests whether a predicate holds for one or more elements in the array.

      > SELECT `EXISTS`(array(1, 2, 3), x -> x % 2 == 0);
       true
      > SELECT `EXISTS`(array(1, 2, 3), x -> x % 2 == 10);
       false
      > SELECT `EXISTS`(array(1, null, 3), x -> x % 2 == 0);
       NULL
      > SELECT `EXISTS`(array(0, null, 2, 3, null), x -> x IS NULL);
       true
      > SELECT `EXISTS`(array(1, 2, 3), x -> x IS NULL);
       false
      

      In Calcite, EXISTS is a keyword, so we need to specify the function with back quotes.
      Moreover, `EXISTS` is a higher-order function, and if we want to support higher-order functions in Calcite, we must first support lambda expressions

      Attachments

        Issue Links

          Activity

            People

              hongyuguo hongyu guo
              hongyuguo hongyu guo
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: