Taking inspiration from Pace, this seems to work and for arbitrary divisor. It works for negative numbers too:
divisor = 5
arr = pa.array(range(-100, 100))
tab = pa.Table.from_arrays([arr], names=['x'])
my_filter = pc.subtract(pc.field("x"), pc.multiply(pc.divide(pc.field("x"), divisor), divisor)) == 0
filtered = ds.dataset(tab).to_table(filter=my_filter)
print(filtered)
# pyarrow.Table
# x: int64
# ----
# x: [[-100,-95,-90,-85,-80,...,75,80,85,90,95]]
Or, cleaned up a bit:
def pc_mod(field: str, divisor: int):
return pc.subtract(pc.field(field), pc.multiply(pc.divide(pc.field(field), divisor), divisor)) == 0
print(ds.dataset(tab).to_table(filter=pc_mod("x", 5)))
# pyarrow.Table
# x: int64
# ----
# x: [[-100,-95,-90,-85,-80,...,75,80,85,90,95]]