[ 
https://issues.apache.org/jira/browse/SEDONA-4?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17446503#comment-17446503
 ] 

Adam Binford commented on SEDONA-4:
-----------------------------------

Yeah this would need a pretty big overhaul to properly fix for all the 
functions. Ideally would be a similar setup to the Spark codebase I think with 
a parent class that calls a `nullSafeEval` on the subclasss (or returns null if 
one of the children are null). Unfortunately would have to do this on our own 
instead of using the built-in base classes (UnaryExpression, BinaryExpression, 
etc.) because of the 3.1/3.2 compatibility issue with those classes. 

> Graceful handling of null geometries in ST_Distance function
> ------------------------------------------------------------
>
>                 Key: SEDONA-4
>                 URL: https://issues.apache.org/jira/browse/SEDONA-4
>             Project: Apache Sedona
>          Issue Type: Improvement
>            Reporter: Hugh Saalmans
>            Assignee: Jia Yu
>            Priority: Minor
>
> Using the _*ST_Distance*_ function with a null geometry triggers a 
> *java.lang.NullPointerException* error.
> Expected behaviour is for the function to return *null*.
> This is a problem in situations when you can't guarantee a geometry isn't 
> null; such as when using _*lead*_ and _*lag*_ with windowing. The workaround 
> is to use a case statement to test for null geoms.
> Platform tested on: AWS EMR with Pyspark 3.0.0 (Python 3.7.9) and Sedona 
> 1.3.2 SNAPSHOT.
> I suspect this issue exists in other functions as well but haven't tested.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to