You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/05/08 06:02:39 UTC

[GitHub] [spark] yaooqinn edited a comment on pull request #28106: [SPARK-31335][SQL] Add try function support

yaooqinn edited a comment on pull request #28106:
URL: https://github.com/apache/spark/pull/28106#issuecomment-625648533


   I see the concerns.
   
   The behavior of `try` here is simply that it wraps a `try-catch` for its root child expression. And the meanings of `try` will be spread based on how the child expression tree to be executed.
   
   For scalar functions,  the meaning would change because the underlying logic can be folded inside the same `try-catch` block. `TRY(a / TRY(MyUDF(b)))` and `TRY(a / MyUDF(b))` are same.
   
   There is no such propagating errors or NULLs thing for aggregates and subqueries as you mentioned, the `try` will stay on the top of its root child and takes no effects. In other words, it does not work for aggregates and subqueries.
   
   `TRY(SUM(a/b))` and `TRY(a IN (SELECT ... WHERE a/b > 1))` can not swallow `divide by zero` error.
   In `TRY(SUM(TRY(a/b)))`, only the second `try` supress runtime errors.
    
   
   Maybe we can and a checker and forbid `try` to be used for aggregates and subqueries explicitly. then there would be no ambiguity 


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org