vibhatha commented on code in PR #14024:
URL: https://github.com/apache/arrow/pull/14024#discussion_r962061860


##########
python/pyarrow/_substrait.pyx:
##########
@@ -25,14 +26,84 @@ from pyarrow.includes.libarrow cimport *
 from pyarrow.includes.libarrow_substrait cimport *
 
 
-def run_query(plan):
+cdef shared_ptr[CTable] _process_named_table(dict named_args, const 
std_vector[c_string]& names):
+    cdef:
+        c_string c_name
+        shared_ptr[CTable] empty_table
+    py_names = []
+
+    # provider function could raise an exception
+    try:
+        for i in range(names.size()):
+            c_name = names[i]
+            py_names.append(frombytes(c_name))
+        return pyarrow_unwrap_table(named_args["provider"](py_names))
+    except Exception:
+        return empty_table

Review Comment:
   How about doing a `raise` instead. 
   
   ```bash
   pyarrow/tests/test_substrait.py::test_named_table_invalid_table_name
     
/Users/vibhatha/venv/pyarrow_dev/lib/python3.10/site-packages/_pytest/unraisableexception.py:78:
 PytestUnraisableExceptionWarning: Exception ignored in: 
'pyarrow._substrait._process_named_table'
     
     Traceback (most recent call last):
       File "pyarrow/_substrait.pyx", line 39, in 
pyarrow._substrait._process_named_table
         return pyarrow_unwrap_table(named_args["provider"](py_names))
       File 
"/Users/vibhatha/github/fork/arrow/python/pyarrow/tests/test_substrait.py", 
line 223, in table_provider
         raise Exception("Unrecognized table name")
     Exception: Unrecognized table name
     
     During handling of the above exception, another exception occurred:
     
     Traceback (most recent call last):
       File 
"/Users/vibhatha/github/fork/arrow/python/pyarrow/tests/test_substrait.py", 
line 252, in test_named_table_invalid_table_name
         substrait.run_query(buf, table_provider)
     ValueError: Error occurred in extracting NamedTable : Unrecognized table 
name
     
       warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
   ```
   
   I want to fix this warning. Not sure if we can handle it here properly. 



-- 
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: github-unsubscr...@arrow.apache.org

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

Reply via email to