same#

Description#

Return true if A is the same as B. Different from the = operator or eq which implements ternary logic, same treats null as a unique value by itself and therefore can be used to compare nullable values. For instance, same(null, null) returns true, and same(null, "hello") returns false, whereas both null=null and null="hello" return null.

Return type#

bool

Domain#

This is a scalar function (calculates a single output value for a single input row.)

Categories#

Usage#

same(a, b)

Argument

Type

Optional

Repeatable

Restrictions

a

comparable

no

no

none

b

comparable

no

no

none

Examples#

make_col s:same(col1, col2)

Set s to true if column col1 contains the same value as col2, and false otherwise. Here a null value is considered the same as another null value, and as a result s will never contain any null value.