Create a new SampleExec with Bernoulli sampling (without replacement). # Arguments `input` - The input execution plan `lower_bound` - Lower bound of sampling range (typically 0.0) `upper_bound` - Upper bound of sampling range (0.0 to 1.0) `seed` - Random seed for reproducible sampling
(
input: Arc<dyn ExecutionPlan>,
lower_bound: f64,
upper_bound: f64,
seed: u64,
)
| 629 | /// * `upper_bound` - Upper bound of sampling range (0.0 to 1.0) |
| 630 | /// * `seed` - Random seed for reproducible sampling |
| 631 | pub fn try_new( |
| 632 | input: Arc<dyn ExecutionPlan>, |
| 633 | lower_bound: f64, |
| 634 | upper_bound: f64, |
| 635 | seed: u64, |
| 636 | ) -> Result<Self> { |
| 637 | if lower_bound < 0.0 || upper_bound > 1.0 || lower_bound > upper_bound { |
| 638 | return internal_err!( |
| 639 | "Sampling bounds must satisfy 0.0 <= lower <= upper <= 1.0, got [{}, {}]", |
| 640 | lower_bound, |
| 641 | upper_bound |
| 642 | ); |
| 643 | } |
| 644 | |
| 645 | let cache = PlanProperties::new( |
| 646 | EquivalenceProperties::new(input.schema()), |
| 647 | input.properties().partitioning.clone(), |
| 648 | input.properties().emission_type, |
| 649 | input.properties().boundedness, |
| 650 | ); |
| 651 | |
| 652 | Ok(Self { |
| 653 | input, |
| 654 | lower_bound, |
| 655 | upper_bound, |
| 656 | seed, |
| 657 | metrics: ExecutionPlanMetricsSet::new(), |
| 658 | cache: Arc::new(cache), |
| 659 | }) |
| 660 | } |
| 661 | |
| 662 | /// Create a sampler for the given partition. |
| 663 | fn create_sampler(&self, partition: usize) -> BernoulliSampler { |
nothing calls this directly
no test coverage detected