Richard Durkee created SPARK-56976:
--------------------------------------

             Summary: Support Two-Argument IF(condition, value) Returning NULL
                 Key: SPARK-56976
                 URL: https://issues.apache.org/jira/browse/SPARK-56976
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 5.0.0
            Reporter: Richard Durkee


Currently Spark's IF function requires exactly three arguments:

 
{code:java}
IF(condition, trueValue, falseValue){code}
 

The two-argument form, IF(condition, value), returns value when true and NULL 
when false. This is supported by MySQL, Trino/Presto, and BigQuery but rejected 
by Spark with an arity error. 

 

Although there are many existing ways to express this in Spark, such as 
IF(condition, value, NULL) or CASE WHEN condition THEN value END, the 
two-argument form is more concise and matches user expectations when migrating 
from other SQL engines. This is especially important for automated migration. 

{{}}

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to