Repository navigation
Conversation
|
|
There was a problem hiding this comment.
🟡 Changes recommended
The new subprocess-based test should be marked with @pytest.mark.processes so it can be skipped on platforms/configurations where process creation is disabled.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes a crash in the PyArrow compute bindings by validating the optional func_registry argument passed to pyarrow.compute.call_tabular_function() before performing the Cython cast, so invalid types raise a catchable TypeError instead of segfaulting.
Changes:
- Add a runtime type check for
func_registryincall_tabular_function()and raiseTypeErroron invalid values. - Add a regression test that runs the call in a subprocess to assert the failure mode is a Python exception (not a process crash).
File summaries
| File | Description |
|---|---|
| python/pyarrow/_compute.pyx | Adds func_registry type validation before casting to a native registry pointer. |
| python/pyarrow/tests/test_compute.py | Adds a subprocess-based regression test to ensure invalid registries raise TypeError rather than crashing. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟢 Approval recommended
The fix is narrowly scoped, matches the stated user-facing behavior, and is covered by a regression test that would fail under the prior segfaulting implementation.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
AlenkaF
left a comment
There was a problem hiding this comment.
Would it make sense to also add a check in _register_user_defined_function as every register_* function uses that?
There was a problem hiding this comment.
🟡 Changes recommended
The added regression test should be executed in a subprocess (as described) to remain safe if the segfault regresses and to avoid crashing the test runner.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
|
Two things left:
|
|
|
|
Done in 388ac7b. |
|
|
1 similar comment
|
|
10eed8b to
80261c3
Compare
Validate call_tabular_function registry inputs before casting them to the native FunctionRegistry pointer. Signed-off-by: Stefan Wang <1fannnw@gmail.com> Signed-off-by: 1fanwang <1fannnw@gmail.com>
The test spawns a subprocess, which Emscripten does not support. Without the marker the test runs there anyway and fails. Signed-off-by: 1fanwang <1fannnw@gmail.com>
The subprocess wrapper guarded against the crash this change removes, so the in-process form reads better now. Signed-off-by: 1fanwang <1fannnw@gmail.com>
Signed-off-by: 1fanwang <1fannnw@gmail.com>
80261c3 to
000992c
Compare
|
|
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
1 open issue
Review effort: Lite
The test passed args=None, which only happened to work because the registry-type check runs before args is touched. Pass a minimal valid value instead so the test still targets registry validation if that ordering ever changes. Signed-off-by: 1fanwang <1fannnw@gmail.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain, and the change is supported by regression coverage for invalid registry arguments across the affected tabular-call and UDF registration paths.
No open issues 🎉
1 resolved since last review
Review effort: Lite

Rationale for this change
Passing an invalid registry to a tabular call or UDF registration can terminate Python. Applications should receive TypeError instead.
Fixes #51228.
What changes are included in this PR?
Validate the registry type before using it. The same check covers scalar, vector, aggregate, and tabular function registration, as well as calling a tabular function directly. Default and explicit valid registries keep working exactly as before.
Are these changes tested?
Built this branch's Cython extension locally against a debug libarrow (commit d867835). Before the fix, a stock PyPI install (26.0.1) crashes outright on both the tabular call and UDF registration paths; after it, both raise a clean TypeError:
Are there any user-facing changes?
Invalid registry arguments raise TypeError instead of terminating Python.
Was AI used for this PR?
In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.
PR code and description written by:
Reviewed before submission by:
call_tabular_function()segfaults for some wrong typedfunc_registryvalues #51228