apache-sparkapache-spark-sql

What is the difference between IF and IFF in spark SQL?


The documentation for both functions is practically identical.

See IF and IFF.

When running (in DBR 13.3, though that should not matter):

SELECT
    IF(1 = 1, 'a', 'b'),  IF(1 = 0, 'a', 'b'),
    IFF(1 = 1, 'a', 'b'), IFF(1 = 0, 'a', 'b')

It results in:

enter image description here

Is there any difference in how these operations behave?


Solution

  • As they have mentioned in the documentation iff is a synonym for if, it is the same as the where and filter