Uploaded image for project: 'Apache Sedona'
  1. Apache Sedona
  2. SEDONA-153

Python Serialization Fails with Nulls

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.3.0

    Description

      The following currently fail due to Shapely not liking nulls/Nones:

      def test_null_deserializer(self):
          result = self.spark.sql("select st_geomfromwkt(null)").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
      

      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

      Edit: I adjusted the deserializer test. I accidentally used a previous version that fails on analysis. This version fails when the None is attempted to be iterated in Python.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dougdennis Doug Dennis
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m