paleolimbot opened a new pull request, #228:
URL: https://github.com/apache/sedona-db/pull/228

   Still working out the details but I think the hard part is done:
   
   ```python
   import sedona.db
   from sedonadb.udf import ScalarUdfImpl
   import pyarrow as pa
   
   sd = sedona.db.connect()
   
   class TestUdf(ScalarUdfImpl):
   
       @property
       def name(self):
           return "does_it_work"
   
       @property
       def volatility(self):
           return "immutable"
   
       def return_type(self, arg_types, scalar_args):
           return pa.int64()
   
       def invoke_batch(self, args, return_type, num_rows):
           print(args)
           print(return_type)
           return pa.array(range(num_rows))
   
   sd._impl.register_udf(TestUdf())
   
   sd.sql("SELECT does_it_work(1, 'two', 3.0)").show()
   #> (PySedonaValue Int64[1], PySedonaValue Utf8[1], PySedonaValue Float64[1])
   #> SedonaType int64<Int64>
   #> ┌───────────────────────────────────────────────┐
   #> │ does_it_work(Int64(1),Utf8("two"),Float64(3)) │
   #> │                     int64                     │
   #> ╞═══════════════════════════════════════════════╡
   #> │                                             0 │
   #> └───────────────────────────────────────────────┘
   ```


-- 
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