jorisvandenbossche commented on code in PR #14331:
URL: https://github.com/apache/arrow/pull/14331#discussion_r988771112


##########
python/pyarrow/_substrait.pyx:
##########
@@ -124,7 +129,10 @@ def run_query(plan, table_provider=None):
         function[CNamedTableProvider] c_named_table_provider
         CConversionOptions c_conversion_options
 
-    c_buf_plan = pyarrow_unwrap_buffer(plan)
+    if isinstance(plan, bytes):
+        c_buf_plan = pyarrow_unwrap_buffer(py_buffer(plan))
+    else:
+        c_buf_plan = pyarrow_unwrap_buffer(plan)

Review Comment:
   ```suggestion
       elif isinstance(plan, Buffer):
           c_buf_plan = pyarrow_unwrap_buffer(plan)
       else:
           raise TypeError(...)
   ```
   
   Possible alternative to the fueed type. While that is a nice trick, it seems 
to give a confusing error message? ("No matching signature found" ?)



##########
python/pyarrow/_substrait.pyx:
##########
@@ -124,7 +129,10 @@ def run_query(plan, table_provider=None):
         function[CNamedTableProvider] c_named_table_provider
         CConversionOptions c_conversion_options
 
-    c_buf_plan = pyarrow_unwrap_buffer(plan)
+    if isinstance(plan, bytes):
+        c_buf_plan = pyarrow_unwrap_buffer(py_buffer(plan))
+    else:
+        c_buf_plan = pyarrow_unwrap_buffer(plan)

Review Comment:
   ```suggestion
       elif isinstance(plan, Buffer):
           c_buf_plan = pyarrow_unwrap_buffer(plan)
       else:
           raise TypeError(...)
   ```
   
   Possible alternative to the fused type. While that is a nice trick, it seems 
to give a confusing error message? ("No matching signature found" ?)



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