Kontinuation opened a new issue, #2565:
URL: https://github.com/apache/sedona/issues/2565

   This is a short repro for the problem:
   
   ```python
   spark.sql(
       """
       WITH t AS (SELECT explode(array(NULL, ST_GeomFromWKT('POINT (1 2)'), 
NULL)) AS geom)
       SELECT ST_Envelope_Aggr(geom) FROM t
       """
   ).show()
   ```
   
   This query fails with the following exception:
   
   ```
   org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in 
stage 3.0 failed 1 times, most recent failure: Lost task 0.0 in stage 3.0 (TID 
2) (bos-laptop.bbrouter executor driver): java.lang.NullPointerException: 
Cannot invoke "org.locationtech.jts.geom.Geometry.getEnvelopeInternal()" 
because "input" is null
        at 
org.apache.spark.sql.sedona_sql.expressions.ST_Envelope_Aggr.reduce(AggregateFunctions.scala:112)
        at 
org.apache.spark.sql.sedona_sql.expressions.ST_Envelope_Aggr.reduce(AggregateFunctions.scala:106)
        at 
org.apache.spark.sql.execution.aggregate.ScalaAggregator.update(udaf.scala:527)
   ```
   
   Other aggregation functions such as `ST_Union_Aggr`, `ST_Intersection_Aggr` 
have the same problem. The correct behavior should be ignoring NULL inputs, and 
return NULL when the inputs are all NULLs.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to