dtenedor opened a new pull request, #47817: URL: https://github.com/apache/spark/pull/47817
### What changes were proposed in this pull request? This PR creates SQL function aliases for 'zeroifnull' and 'nullifzero'. These are equivalent to `nvl(input, 0)` and `if(input = 0, null, input)`, respectively. The analyzer performs these replacements inline in this PR to take advantage of existing query optimizations for `nvl` and `if` expressions. For example: ``` > select zeroifnull(null); 0 > select zeroifnull(2); 2 > select nullifzero(0); null > select nullifzero(2); 2 ``` ### Why are the changes needed? We are adding these functions for compatibility with other systems which also have these SQL functions. ### Does this PR introduce _any_ user-facing change? Yes, see above. ### How was this patch tested? This PR adds unit test coverage. ### Was this patch authored or co-authored using generative AI tooling? No. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org