You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/10/06 15:26:33 UTC

[GitHub] [arrow] wjones127 commented on a diff in pull request #14331: ARROW-17944: [Python] substrait.run_query accept bytes/Buffer and not segfault

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


##########
python/pyarrow/tests/test_substrait.py:
##########
@@ -86,6 +86,22 @@ def test_run_serialized_query(tmpdir):
     assert table.select(["foo"]) == res_tb.select(["foo"])
 
 
+@pytest.mark.parametrize("query", (pa.py_buffer(b'buffer'), b"bytes", 1))
+def test_run_query_input_types(tmpdir, query):
+
+    # Passing unsupported type, like int, will not segfault.
+    if not any(isinstance(query, c) for c in (pa.Buffer, bytes)):

Review Comment:
   FYI you can pass a tuple to check if the object matches any of the types:
   
   ```suggestion
       if not isinstance(query, (pa.Buffer, bytes)):
   ```
   
   https://docs.python.org/3.6/library/functions.html#isinstance



-- 
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-unsubscribe@arrow.apache.org

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