Skip to content

Commit a7c1f20

Browse files
adriangbalamb
andauthored
Apply suggestions from code review
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
1 parent cd2202e commit a7c1f20

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

datafusion/catalog/src/table.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,10 @@ impl<'a> ScanArgs<'a> {
470470
self.limit
471471
}
472472

473-
/// Set the statistics the caller would like the provider to answer for
474-
/// this scan, if it can do so cheaply.
473+
/// Specifies the statistics the caller may use when optimizing the query.
474+
///
475+
/// This is intended for to allow the provider to cheaply provide statistics that may help
476+
/// such as those it has in an in memory catalog or from some other metadata source.
475477
///
476478
/// Providers read these via [`Self::statistics_requests()`]; anything a
477479
/// provider cannot answer cheaply it simply ignores. DataFusion's own
@@ -487,6 +489,8 @@ impl<'a> ScanArgs<'a> {
487489
}
488490

489491
/// Get the statistics requests for the scan. Empty if none were set.
492+
///
493+
/// See [`Self::with_statistics_requests`] for more details
490494
pub fn statistics_requests(&self) -> &'a [StatisticsRequest] {
491495
self.statistics_requests
492496
}

datafusion/expr/src/logical_plan/plan.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2796,16 +2796,9 @@ pub struct TableScan {
27962796
pub fetch: Option<usize>,
27972797
/// Statistics the planner would like the provider to answer for this
27982798
/// scan, typically attached by a custom optimizer rule from the
2799-
/// surrounding plan shape (e.g. Min/Max for sort keys). Threaded into
2800-
/// the table provider via `ScanArgs::statistics_requests` at
2801-
/// physical-planning time. Advisory and empty by default; DataFusion's
2802-
/// own rules never populate it.
2799+
/// surrounding plan (e.g. Min/Max for sort keys).
28032800
///
2804-
/// A [`BTreeSet`], not a `Vec`: optimizer rules run to a fixpoint, so the
2805-
/// collection must be idempotent under re-derivation — a rule `insert`s
2806-
/// the requests it wants and re-running is a no-op (and composes with
2807-
/// other rules) without each rule having to dedupe. The ordering also
2808-
/// keeps the resulting plan deterministic.
2801+
/// A [`BTreeSet`], not a `Vec` to keep the resulting plan deterministic.
28092802
pub statistics_requests: BTreeSet<StatisticsRequest>,
28102803
}
28112804

0 commit comments

Comments
 (0)