[ https://issues.apache.org/jira/browse/CALCITE-5430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17657012#comment-17657012 ]
Julian Hyde commented on CALCITE-5430: -------------------------------------- In [julianhyde/5430-ifnull|https://github.com/julianhyde/calcite/tree/5430-ifnull] I made it easier to call the existing tests for the NVL function and have them call the {{IFNULL}} function instead. It's not ready to merge but it illustrates how we might share tests when a function is an alias for another. I'll keep on working on it. There were a couple of failures - e.g. incorrectly deducing that the type of {{IFNULL(null, 'abc')}} is {{VARCHAR(3)}} when it should be {{VARCHAR(3) NOT NULL}} - that I think would go away if the implementation of {{IFNULL}} is based on {{NVL}}. > Implement IFNULL() for BigQuery dialect > --------------------------------------- > > Key: CALCITE-5430 > URL: https://issues.apache.org/jira/browse/CALCITE-5430 > Project: Calcite > Issue Type: Improvement > Reporter: Oliver Lee > Assignee: Oliver Lee > Priority: Trivial > > Implementing IFNULL() for BIG_QUERY dialect > > IFNULL(expr, null_result) > If {{expr}} evaluates to {{{}NULL{}}}, returns {{{}null_result{}}}. > Otherwise, returns expr. If {{expr}} doesn't evaluate to {{{}NULL{}}}, > {{null_result}} isn't evaluated. > [https://cloud.google.com/bigquery/docs/reference/standard-sql/conditional_expressions#ifnull] > > > example: > {{ifnull(null, 5)}} -> returns 5 > {{ifnull(1,2)}} -> returns 1 -- This message was sent by Atlassian Jira (v8.20.10#820010)