Open
Description
Problem
I need deterministic random sampling within partitions using a seed value. I want to generate SQL like ORDER BY RAND(42) but cannot find a way to pass a seed parameter to ibis random functions.
Current Code
# This works for random sampling (no seed)
order_by = [ibis.random()]
window_spec = ibis.window(group_by=['day_partition', 'hour_partition'], order_by=order_by)
Desired SQL Output
ROW_NUMBER() OVER (PARTITION BY day_partition, hour_partition ORDER BY RAND(42))
Attempted Solutions
- ibis.random() with seed - No seed parameter supported
- ops.RandomScalar(seed=42) - TypeError: got an unexpected keyword argument 'seed'
- ibis.sql(f"RAND({seed})") - AttributeError: module 'ibis' has no attribute 'sql'
- ibis.literal(f"RAND({seed})") - Produces string literal 'RAND(42)' instead of function call
- ibis.param("int64") - Results in ORDER BY 42 (constant value, no randomness)
Thanks in advance.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
backlog