[ https://issues.apache.org/jira/browse/FLINK-10049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16813002#comment-16813002 ]
Xingcan Cui commented on FLINK-10049: ------------------------------------- Hey guys, thanks for the comments. I've not gone through all the documents, but it seems true that different SQL engines have different mechanisms for this problem. However, since all the fields in Flink SQL are nullable in the current version, simply throwing NPE and terminating the execution should always be avoided. IMO, each UDF is responsible to handle {{NULL}} arguments itself, with the correct semantics. The {{NULL}} means unknown in SQL, and thus most scalar functions should output "unknown" with an unknown input. We can add the {{RETURNS NULL ON NULL INPUT}} option to UDF definitions (maybe a method to be overridden), but it works more like an optimization method, which means event without this declaration, the function should return "NULL" after being invoked (just in case). Actually, there's no need to unify the processing logic. Just keep the correct semantics and avoid terminating the (continuous) queries unexpectedly. Thus, I plan to rename this ticket to "Correctly handle NULL arguments in SQL built-in functions". As for the exception handling mechanism, it's a little bit different and we'd better discuss it in another place. What do you think? > Unify the processing logic for NULL arguments in SQL built-in functions > ----------------------------------------------------------------------- > > Key: FLINK-10049 > URL: https://issues.apache.org/jira/browse/FLINK-10049 > Project: Flink > Issue Type: Improvement > Components: Table SQL / API > Reporter: Xingcan Cui > Assignee: vinoyang > Priority: Major > > Currently, the built-in functions treat NULL arguments in different ways. > E.g., ABS(NULL) returns NULL, while LOG10(NULL) throws an NPE. The general > SQL-way of handling NULL values should be that if one argument is NULL the > result is NULL. We should unify the processing logic for that. -- This message was sent by Atlassian JIRA (v7.6.3#76005)