Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arr_filter - use an array of function pointers to apply different filters to multiple columns #14

Open
Kiyoshika opened this issue Feb 2, 2022 · 1 comment
Assignees
Labels
C This issue is related to C code enhancement New feature or request Python This issue is related to Python code

Comments

@Kiyoshika
Copy link
Owner

Kiyoshika commented Feb 2, 2022

Currently, arr_filter supports applying the same filter to multiple columns. Want to provide functionality to apply different filters to different columns at the same time which would be more useful. Would probably have to change the function pointer to a pointer to function pointers.

In the underlying C code, could probably wrap this more complicated function around arr_filter and call it arr_filter_multiple or something like that. Then we can iterate over the array of function pointers and call arr_filter each time to modify the same array.

The method call in Python wrapper would ultimately look something like:

def filter_1(x):
    x = cast(x, POINTER(c_int32))
    return x.contents.value == 10

def filter_2(x):
    x = cast(x, POINTER(c_int32))
    return x.contents.value < 20

# apply filter_1 to column index 0
# apply filter_2 to column index 1 and 2
array filtered = arr.filter([filter_1, filter_2], [[0], [1,2]], 'ANY')

Where we can overload the filter method if the second parameter is a list of lists instead of a regular list.

@Kiyoshika Kiyoshika added enhancement New feature or request C This issue is related to C code labels Feb 2, 2022
@Kiyoshika Kiyoshika self-assigned this Feb 2, 2022
@Kiyoshika Kiyoshika added the Python This issue is related to Python code label Feb 2, 2022
@Kiyoshika
Copy link
Owner Author

In the C implementation, planning to call this arr_multi_filter and implement it in the filter.c file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C This issue is related to C code enhancement New feature or request Python This issue is related to Python code
Projects
None yet
Development

No branches or pull requests

1 participant