petern48 commented on code in PR #8:
URL: https://github.com/apache/sedona-db/pull/8#discussion_r2316747410


##########
python/sedonadb/python/sedonadb/testing.py:
##########
@@ -183,6 +188,10 @@ def result_to_tuples(self, result, *, wkt_precision=None) 
-> List[Tuple[str]]:
             # isinstance() does not always work with pyarrow in pytest
             if _type_is_geoarrow(col.type):
                 columns.append(ga.format_wkt(col, 
precision=wkt_precision).to_pylist())
+            elif datatype == "binary":
+                binary_lst = col.cast(pa.binary()).to_pylist()
+                # Convert to hex format for comparison e.g 
b'0101000000000000000000F03F000000000000F03F',
+                columns.append([b.hex().upper().encode() for b in binary_lst])

Review Comment:
   `col.cast(pa.string())` leads to this error, so it seems like I needed to 
use `pa.binary()` instead
   ```
   python/sedonadb/testing.py:196: in result_to_tuples
       columns.append(col.cast(pa.string()).to_pylist())
   pyarrow/table.pxi:597: in pyarrow.lib.ChunkedArray.cast
       ???
   
/Users/peter/.pyenv/versions/3.10.18/lib/python3.10/site-packages/pyarrow/compute.py:412:
 in cast
       return call_function("cast", [arr], options, memory_pool)
   pyarrow/_compute.pyx:604: in pyarrow._compute.call_function
       ???
   pyarrow/_compute.pyx:399: in pyarrow._compute.Function.call
       ???
   pyarrow/error.pxi:155: in pyarrow.lib.pyarrow_internal_check_status
       ???
   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
   
   >   ???
   E   pyarrow.lib.ArrowInvalid: Invalid UTF8 payload
   ```



-- 
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: issues-unsubscr...@sedona.apache.org

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

Reply via email to