In order to execute Python code, a thread must hold the GIL
Query threads would need to call PyGILState_Ensure() to create a thread state and acquire the GIL
This would necessitate the main thread to release and later reacquire the GIL, which could negatively impact performance even for queries that don't use the proposed filter() method
The impact could be mitigated by only releasing the GIL if no results are pending
If a query potentially blocks for I/O, the query engine should probably release the GIL anyway
Allow users to select features using Python functions or lambdas, similar to Python's built-in
filter()
, e.g.:Challenges:
PyGILState_Ensure()
to create a thread state and acquire the GILfilter()
method