All Products
Search
Document Center

MaxCompute:BOOL_OR

Last Updated:Sep 17, 2026

Performs a logical OR operation on a set of Boolean values and returns the Boolean result.

Syntax

BOOLEAN BOOL_OR(BOOLEAN <expr>)

Parameters

expr: Required. A Boolean type expression.

Return value

A value of the Boolean type is returned. The return value follows these rules:

  • If at least one value in the input expression is true, true is returned. If all values are false, false is returned.

  • If the input expression contains NULL values, these NULL values do not participate in the calculation.

Examples

  • Example 1: Perform a simple logical OR operation.

    SELECT BOOL_OR(colname) FROM VALUES (true), (false), (false) AS tab(colname);
    -- Result
    +------+
    | _c0  | 
    +------+
    | true | 
    +------+
  • Example 2: When NULL values exist in the array, they are ignored in the group.

    SELECT BOOL_OR(colname) FROM VALUES (NULL), (true), (false) AS tab(colname);
    -- Result
    +------+
    | _c0  | 
    +------+
    | true | 
    +------+
    
    SELECT BOOL_OR(colname1) FROM VALUES (false), (false), (NULL) AS tab(colname1);
    -- Result
    +------+
    | _c0  | 
    +------+
    | false | 
    +------+
  • Example 3: Calculate the logical OR result of all rows in the colname1 column where colname2=1.

    SELECT BOOL_OR(colname1) FILTER(WHERE colname2 = 1) FROM VALUES (true, 1), (false, 1), (true, 2) AS tab(colname1, colname2);
    -- Result
    +------+
    | _c0  | 
    +------+
    | true | 
    +------+