apache / datafusion

Apache DataFusion SQL Query Engine
https://datafusion.apache.org/
Apache License 2.0
6.26k stars 1.18k forks source link

Support setseed function #12776

Open my-vegetable-has-exploded opened 1 month ago

my-vegetable-has-exploded commented 1 month ago

Is your feature request related to a problem or challenge?

support select setseed(xxx);

Here is defination in pg. https://www.postgresql.org/docs/current/functions-math.html

setseed ( double precision ) → void

Sets the seed for subsequent random() and random_normal() calls; argument must be between -1.0 and 1.0, inclusive

setseed(0.12345)

It will be helpful to create random but unchanging test data.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

alamb commented 1 month ago

Given DataFusion is multi-threaded and there isn't one global random number generator, and the plans may not run in deterministic order (due to thread scheduling, etc) it is not quite clear to me how we could support this