maxIgnoreNull

Syntax

maxIgnoreNull(X, Y)

Arguments

X and Y can be a numeric, LITERAL or TEMPORAL scalar, pair, vector or matrix.

Details

A binary scalar function that returns the maximum by comparing X with Y.

Difference between max and maxIgnoreNull:

  • max: NULL is treated as the minimum value if nullAsMinValueForComparison=true, otherwise comparison involving NULL returns NULL.

  • maxIgnoreNull: NULL is ignored in comparison and non-NULL maximum is returned. If both elements in X and Y are NULL, NULL is returned. This function is not affected by configuration parameter nullAsMinValueForComparison.

Examples

maxIgnoreNull(2,matrix(1  NULL 4,-1 4  0)) 
#0 #1
2 2
2 4
4 2
maxIgnoreNull(matrix(10 3 NULL, 1 7 4),matrix(1  NULL 4,-1 4  0))
#0 #1
10 1
3 7
-4 4

Use minIgnoreNull with reduce to calculate the minimum for matrices of the same shape stored in a tuple:

n1 = matrix(1 1 1, 5 5 5)
n2 = matrix(10 11 12, 0 NULL -5)
n3 = matrix(-1 1 NULL, -3 0 10)
reduce(minIgnoreNull, [n1,n2,n3])
#0 #1
10 5
11 5
12 10

Related function: minIgnoreNull