Doug Dennis created SEDONA-153:
----------------------------------

             Summary: Python Serialization Fails with Nulls
                 Key: SEDONA-153
                 URL: https://issues.apache.org/jira/browse/SEDONA-153
             Project: Apache Sedona
          Issue Type: Bug
            Reporter: Doug Dennis


The following currently fail due to Shapely not liking nulls/Nones:
{code:python}
def test_null_deserializer(self):
    result = self.spark.sql("select cast(null as geometry)").collect()[0][0]
    assert result is None

def test_null_serializer(self):
    data = [
        [1, None]
    ]
    schema = t.StructType(
        [
            t.StructField("id", IntegerType(), True),
            t.StructField("geom", GeometryType(), True),
        ]
    )
    self.spark.createDataFrame(
        data,
        schema
    ).createOrReplaceTempView("points")

    count = self.spark.sql("select count from points").collect()[0][0]
    assert count == 1
{code}
The solution is to add some null guards to methods in the python GeometryType 
class. I can make a PR for this but I wasn't sure if I needed to wait for this 
issue to be approved or acknowledged or something :)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to