Skip to content

Commit 69e189d

Browse files
chore: Format examples in doc strings - functions (#18353)
## Which issue does this PR close? Part of #16915 ## Rationale for this change Format code examples in documentation comments to improve readability and maintain consistent code style across the codebase. This is part of a multi-PR effort to format all doc comment examples and eventually enable CI checks to enforce this formatting. ## What changes are included in this PR? Run `cargo fmt -p <crate> -- --config format_code_in_doc_comments=true` for the following datasource-related crates: - `datafusion-functions` - `datafusion-functions-aggregate` - `datafusion-functions-aggregate-common` - `datafusion-functions-nested` - `datafusion-functions-table` - `datafusion-functions-window` - `datafusion-functions-window-common` ## Are these changes tested? No testing needed - this is purely a formatting change with no functional modifications. ## Are there any user-facing changes? No - this only affects documentation formatting.
1 parent 2a9a495 commit 69e189d

File tree

17 files changed

+6
-26
lines changed

17 files changed

+6
-26
lines changed

datafusion/functions-aggregate-common/src/aggregate/groups_accumulator.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,13 @@ use datafusion_expr_common::groups_accumulator::{EmitTo, GroupsAccumulator};
8080
/// Logical group Current Min/Max value for that group stored
8181
/// number as a ScalarValue which points to an
8282
/// individually allocated String
83-
///
84-
///```
83+
/// ```
8584
///
8685
/// # Optimizations
8786
///
8887
/// The adapter minimizes the number of calls to [`Accumulator::update_batch`]
8988
/// by first collecting the input rows for each group into a contiguous array
9089
/// using [`compute::take`]
91-
///
9290
pub struct GroupsAccumulatorAdapter {
9391
factory: Box<dyn Fn() -> Result<Box<dyn Accumulator>> + Send>,
9492

@@ -184,7 +182,6 @@ impl GroupsAccumulatorAdapter {
184182
/// └─────────┘ └─────────┘ └ ─ ─ ─ ─ ┘ └─────────┘ └ ─ ─ ─ ─ ┘
185183
///
186184
/// logical group values opt_filter logical group values opt_filter
187-
///
188185
/// ```
189186
fn invoke_per_accumulator<F>(
190187
&mut self,

datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/accumulate.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,6 @@ mod test {
760760

761761
/// Calls `NullState::accumulate` and `accumulate_indices` to
762762
/// ensure it generates the correct values.
763-
///
764763
fn accumulate_test(
765764
group_indices: &[usize],
766765
values: &UInt32Array,

datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/prim_op.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ where
142142
/// The state is:
143143
/// - self.prim_fn for all non null, non filtered values
144144
/// - null otherwise
145-
///
146145
fn convert_to_state(
147146
&self,
148147
values: &[ArrayRef],

datafusion/functions-aggregate-common/src/tdigest.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,6 @@ impl TDigest {
575575
/// │└ ─ ─ ─ ┘│
576576
/// │ │
577577
/// ...
578-
///
579578
/// ```
580579
///
581580
/// The [`TDigest::from_scalar_state()`] method reverses this processes,

datafusion/functions-aggregate/src/count.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ pub fn count_all() -> Expr {
113113
/// // create `count(*)` OVER ... window function expression
114114
/// let expr = count_all_window();
115115
/// assert_eq!(
116-
/// expr.schema_name().to_string(),
117-
/// "count(Int64(1)) ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING"
116+
/// expr.schema_name().to_string(),
117+
/// "count(Int64(1)) ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING"
118118
/// );
119119
/// // if you need to refer to this column, use the `schema_name` function
120120
/// let expr = col(expr.schema_name().to_string());

datafusion/functions-aggregate/src/median.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ impl<T: ArrowNumericType> Accumulator for MedianAccumulator<T> {
302302
/// of groups before final evaluation.
303303
/// So values in each group will be stored in a `Vec<T>`, and the total group values
304304
/// will be actually organized as a `Vec<Vec<T>>`.
305-
///
306305
#[derive(Debug)]
307306
struct MedianGroupsAccumulator<T: ArrowNumericType + Send> {
308307
data_type: DataType,

datafusion/functions-aggregate/src/percentile_cont.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,6 @@ impl<T: ArrowNumericType> Accumulator for PercentileContAccumulator<T> {
457457
/// of groups before final evaluation.
458458
/// So values in each group will be stored in a `Vec<T>`, and the total group values
459459
/// will be actually organized as a `Vec<Vec<T>>`.
460-
///
461460
#[derive(Debug)]
462461
struct PercentileContGroupsAccumulator<T: ArrowNumericType + Send> {
463462
data_type: DataType,

datafusion/functions-nested/src/expr_ext.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ use crate::extract::{array_element, array_slice};
3636
/// ```
3737
/// # use datafusion_expr::{lit, col, Expr};
3838
/// # use datafusion_functions_nested::expr_ext::IndexAccessor;
39-
/// let expr = col("c1")
40-
/// .index(lit(3));
39+
/// let expr = col("c1").index(lit(3));
4140
/// assert_eq!(expr.schema_name().to_string(), "c1[Int32(3)]");
4241
/// ```
4342
pub trait IndexAccessor {
@@ -66,8 +65,7 @@ impl IndexAccessor for Expr {
6665
/// ```
6766
/// # use datafusion_expr::{lit, col};
6867
/// # use datafusion_functions_nested::expr_ext::SliceAccessor;
69-
/// let expr = col("c1")
70-
/// .range(lit(2), lit(4));
68+
/// let expr = col("c1").range(lit(2), lit(4));
7169
/// assert_eq!(expr.schema_name().to_string(), "c1[Int32(2):Int32(4)]");
7270
/// ```
7371
pub trait SliceAccessor {

datafusion/functions-nested/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
//! [DataFusion]: https://crates.io/crates/datafusion
3333
//!
3434
//! You can register the functions in this crate using the [`register_all`] function.
35-
//!
3635
3736
#[macro_use]
3837
pub mod macros;

datafusion/functions-window-common/src/expr.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ impl<'a> ExpressionArgs<'a> {
3939
/// to the user-defined window function.
4040
/// * `input_fields` - The fields corresponding to the
4141
/// arguments to the user-defined window function.
42-
///
4342
pub fn new(
4443
input_exprs: &'a [Arc<dyn PhysicalExpr>],
4544
input_fields: &'a [FieldRef],

0 commit comments

Comments
 (0)