Apache DataFusion SQL Query Engine
Fix clippy errors for Rust 1.80 (#11654)
Piotr Findeisen6fd57b2e385e
diff --git a/Cargo.toml b/Cargo.tomlindex cb27a8761a..9e7971bdc1 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -154,4 +154,5 @@ rpath = falselarge_futures = "warn"[workspace.lints.rust]+unexpected_cfgs = { level = "warn", check-cfg = ["cfg(tarpaulin)"] }unused_imports = "deny"diff --git a/datafusion/common/Cargo.toml b/datafusion/common/Cargo.tomlindex 62ea85a4a3..85dfb2e8f7 100644--- a/datafusion/common/Cargo.toml+++ b/datafusion/common/Cargo.toml@@ -39,6 +39,7 @@ path = "src/lib.rs"avro = ["apache-avro"]backtrace = []pyarrow = ["pyo3", "arrow/pyarrow", "parquet"]+force_hash_collisions = [][dependencies]ahash = { workspace = true }diff --git a/datafusion/common/src/config.rs b/datafusion/common/src/config.rsindex 6e007ded03..1f20bd2550 100644--- a/datafusion/common/src/config.rs+++ b/datafusion/common/src/config.rs@@ -1207,7 +1207,7 @@ impl ConfigField for TableOptions {/// # Parameters////// * `key`: The configuration key specifying which setting to adjust, prefixed with the format (e.g., "format.delimiter")- /// for CSV format.+ /// for CSV format./// * `value`: The value to set for the specified configuration key.////// # Returnsdiff --git a/datafusion/common/src/hash_utils.rs b/datafusion/common/src/hash_utils.rsindex 010221b048..5e1324e807 100644--- a/datafusion/common/src/hash_utils.rs+++ b/datafusion/common/src/hash_utils.rs@@ -17,22 +17,27 @@//! Functionality used both on logical and physical plans+#[cfg(not(feature = "force_hash_collisions"))]use std::sync::Arc;use ahash::RandomState;use arrow::array::*;use arrow::datatypes::*;use arrow::row::Rows;+#[cfg(not(feature = "force_hash_collisions"))]use arrow::{downcast_dictionary_array, downcast_primitive_array};use arrow_buffer::IntervalDayTime;use arrow_buffer::IntervalMonthDayNano;+#[cfg(not(feature = "force_hash_collisions"))]use crate::cast::{as_boolean_array, as_fixed_size_list_array, as_generic_binary_array,as_large_list_array, as_list_array, as_map_array, as_primitive_array,as_string_array, as_struct_array,};-use crate::error::{Result, _internal_err};+use crate::error::Result;+#[cfg(not(feature = "force_hash_collisions"))]+use crate::error::_internal_err;// Combines two hashes into one hash#[inline]@@ -41,6 +46,7 @@ pub fn combine_hashes(l: u64, r: u64) -> u64 {hash.wrapping_mul(37).wrapping_add(r)}+#[cfg(not(feature = "force_hash_collisions"))]fn hash_null(random_state: &RandomState, hashes_buffer: &'_ mut [u64], mul_col: bool) {if mul_col {hashes_buffer.iter_mut().for_each(|hash| {@@ -90,6 +96,7 @@ hash_float_value!((half::f16, u16), (f32, u32), (f64, u64));/// Builds hash values of PrimitiveArray and writes them into `hashes_buffer`/// If `rehash==true` this combines the previous hash value in the buffer/// with the new hash using `combine_hashes`+#[cfg(not(feature = "force_hash_collisions"))]fn hash_array_primitive<T>(array: &PrimitiveArray<T>,random_state: &RandomState,@@ -135,6 +142,7 @@ fn hash_array_primitive<T>(/// Hashes one array into the `hashes_buffer`/// If `rehash==true` this combines the previous hash value in the buffer/// with the new hash using `combine_hashes`+#[cfg(not(feature = "force_hash_collisions"))]fn hash_array<T>(array: T,random_state: &RandomState,@@ -180,6 +188,7 @@ fn hash_array<T>(}/// Hash the values in a dictionary array+#[cfg(not(feature = "force_hash_collisions"))]fn hash_dictionary<K: ArrowDictionaryKeyType>(array: &DictionaryArray<K>,random_state: &RandomState,@@ -210,6 +219,7 @@ fn hash_dictionary<K: ArrowDictionaryKeyType>(Ok(())}+#[cfg(not(feature = "force_hash_collisions"))]fn hash_struct_array(array: &StructArray,random_state: &RandomState,@@ -270,6 +280,7 @@ fn hash_map_array(Ok(())}+#[cfg(not(feature = "force_hash_collisions"))]fn hash_list_array<OffsetSize>(array: &GenericListArray<OffsetSize>,random_state: &RandomState,@@ -303,6 +314,7 @@ whereOk(())}+#[cfg(not(feature = "force_hash_collisions"))]fn hash_fixed_list_array(array: &FixedSizeListArray,random_state: &RandomState,@@ -488,7 +500,11 @@ pub fn create_row_hashes_v2<'a>(#[cfg(test)]mod tests {- use arrow::{array::*, datatypes::*};+ use std::sync::Arc;++ use arrow::array::*;+ #[cfg(not(feature = "force_hash_collisions"))]+ use arrow::datatypes::*;use super::*;diff --git a/datafusion/common/src/tree_node.rs b/datafusion/common/src/tree_node.rsindex bb54f4e13a..bcf4d7664a 100644--- a/datafusion/common/src/tree_node.rs+++ b/datafusion/common/src/tree_node.rs@@ -43,14 +43,14 @@ macro_rules! handle_transform_recursion {/// There are three categories of TreeNode APIs:////// 1. "Inspecting" APIs to traverse a tree of `&TreeNodes`:-/// [`apply`], [`visit`], [`exists`].+/// [`apply`], [`visit`], [`exists`].////// 2. "Transforming" APIs that traverse and consume a tree of `TreeNode`s-/// producing possibly changed `TreeNode`s: [`transform`], [`transform_up`],-/// [`transform_down`], [`transform_down_up`], and [`rewrite`].+/// producing possibly changed `TreeNode`s: [`transform`], [`transform_up`],+/// [`transform_down`], [`transform_down_up`], and [`rewrite`].////// 3. Internal APIs used to implement the `TreeNode` API: [`apply_children`],-/// and [`map_children`].+/// and [`map_children`].////// | Traversal Order | Inspecting | Transforming |/// | --- | --- | --- |diff --git a/datafusion/common/src/utils/memory.rs b/datafusion/common/src/utils/memory.rsindex 17668cf93d..2c34b61bd0 100644--- a/datafusion/common/src/utils/memory.rs+++ b/datafusion/common/src/utils/memory.rs@@ -24,7 +24,7 @@ use crate::{DataFusionError, Result};/// # Parameters/// - `num_elements`: The number of elements expected in the hash table./// - `fixed_size`: A fixed overhead size associated with the collection-/// (e.g., HashSet or HashTable).+/// (e.g., HashSet or HashTable)./// - `T`: The type of elements stored in the hash table.////// # Detailsdiff --git a/datafusion/common/src/utils/mod.rs b/datafusion/common/src/utils/mod.rsindex 8264b48725..8b025255f5 100644--- a/datafusion/common/src/utils/mod.rs+++ b/datafusion/common/src/utils/mod.rs@@ -335,7 +335,7 @@ pub fn get_at_indices<T: Clone, I: Borrow<usize>>(/// This function finds the longest prefix of the form 0, 1, 2, ... within the/// collection `sequence`. Examples:/// - For 0, 1, 2, 4, 5; we would produce 3, meaning 0, 1, 2 is the longest satisfying-/// prefix.+/// prefix./// - For 1, 2, 3, 4; we would produce 0, meaning there is no such prefix.pub fn longest_consecutive_prefix<T: Borrow<usize>>(sequence: impl IntoIterator<Item = T>,diff --git a/datafusion/core/Cargo.toml b/datafusion/core/Cargo.tomlindex bed9265ff0..98d501794f 100644--- a/datafusion/core/Cargo.toml+++ b/datafusion/core/Cargo.toml@@ -62,7 +62,7 @@ default = []encoding_expressions = ["datafusion-functions/encoding_expressions"]# Used for testing ONLY: causes all values to hash to the same value (test for collisions)-force_hash_collisions = []+force_hash_collisions = ["datafusion-physical-plan/force_hash_collisions", "datafusion-common/force_hash_collisions"]math_expressions = ["datafusion-functions/math_expressions"]parquet = ["datafusion-common/parquet", "dep:parquet"]pyarrow = ["datafusion-common/pyarrow", "parquet"]diff --git a/datafusion/core/benches/sort.rs b/datafusion/core/benches/sort.rsindex 94a39bbb2a..99a74b61b3 100644--- a/datafusion/core/benches/sort.rs+++ b/datafusion/core/benches/sort.rs@@ -21,7 +21,7 @@//! 1. Creates a list of tuples (sorted if necessary)//!//! 2. Divides those tuples across some number of streams of [`RecordBatch`]-//! preserving any ordering+//! preserving any ordering//!//! 3. Times how long it takes for a given sort plan to process the input//!diff --git a/datafusion/core/src/catalog/mod.rs b/datafusion/core/src/catalog/mod.rsindex 531adc4b21..fc50b4214d 100644--- a/datafusion/core/src/catalog/mod.rs+++ b/datafusion/core/src/catalog/mod.rs@@ -141,12 +141,12 @@ pub trait CatalogList: CatalogProviderList {}/// Here are some examples of how to implement custom catalogs:////// * [`datafusion-cli`]: [`DynamicFileCatalogProvider`] catalog provider-/// that treats files and directories on a filesystem as tables.+/// that treats files and directories on a filesystem as tables.////// * The [`catalog.rs`]: a simple directory based catalog.////// * [delta-rs]: [`UnityCatalogProvider`] implementation that can-/// read from Delta Lake tables+/// read from Delta Lake tables////// [`datafusion-cli`]: https://datafusion.apache.org/user-guide/cli/index.html/// [`DynamicFileCatalogProvider`]: https://github.com/apache/datafusion/blob/31b9b48b08592b7d293f46e75707aad7dadd7cbc/datafusion-cli/src/catalog.rs#L75diff --git a/datafusion/core/src/dataframe/mod.rs b/datafusion/core/src/dataframe/mod.rsindex ea437cc99a..e1021d0626 100644--- a/datafusion/core/src/dataframe/mod.rs+++ b/datafusion/core/src/dataframe/mod.rs@@ -114,15 +114,15 @@ impl Default for DataFrameWriteOptions {/// The typical workflow using DataFrames looks like////// 1. Create a DataFrame via methods on [SessionContext], such as [`read_csv`]-/// and [`read_parquet`].+/// and [`read_parquet`].////// 2. Build a desired calculation by calling methods such as [`filter`],-/// [`select`], [`aggregate`], and [`limit`]+/// [`select`], [`aggregate`], and [`limit`]////// 3. Execute into [`RecordBatch`]es by calling [`collect`]////// A `DataFrame` is a wrapper around a [`LogicalPlan`] and the [`SessionState`]-/// required for execution.+/// required for execution.////// DataFrames are "lazy" in the sense that most methods do not actually compute/// anything, they just build up a plan. Calling [`collect`] executes the plandiff --git a/datafusion/core/src/datasource/listing/helpers.rs b/datafusion/core/src/datasource/listing/helpers.rsindex bfc33ce0bd..29b593a70c 100644--- a/datafusion/core/src/datasource/listing/helpers.rs+++ b/datafusion/core/src/datasource/listing/helpers.rs@@ -49,7 +49,7 @@ use object_store::{ObjectMeta, ObjectStore};/// This means that if this function returns true:/// - the table provider can filter the table partition values with this expression/// - the expression can be marked as `TableProviderFilterPushDown::Exact` once this filtering-/// was performed+/// was performedpub fn expr_applicable_for_cols(col_names: &[String], expr: &Expr) -> bool {let mut is_applicable = true;expr.apply(|expr| {diff --git a/datafusion/core/src/datasource/listing/table.rs b/datafusion/core/src/datasource/listing/table.rsindex 4d0a7738b0..b91a4bd09c 100644--- a/datafusion/core/src/datasource/listing/table.rs+++ b/datafusion/core/src/datasource/listing/table.rs@@ -287,17 +287,17 @@ impl ListingOptions {///# Notes////// - If only one level (e.g. `year` in the example above) is- /// specified, the other levels are ignored but the files are- /// still read.+ /// specified, the other levels are ignored but the files are+ /// still read.////// - Files that don't follow this partitioning scheme will be- /// ignored.+ /// ignored.////// - Since the columns have the same value for all rows read from- /// each individual file (such as dates), they are typically- /// dictionary encoded for efficiency. You may use- /// [`wrap_partition_type_in_dict`] to request a- /// dictionary-encoded type.+ /// each individual file (such as dates), they are typically+ /// dictionary encoded for efficiency. You may use+ /// [`wrap_partition_type_in_dict`] to request a+ /// dictionary-encoded type.////// - The partition columns are solely extracted from the file path. Especially they are NOT part of the parquet files itself.///diff --git a/datafusion/core/src/datasource/physical_plan/parquet/mod.rs b/datafusion/core/src/datasource/physical_plan/parquet/mod.rsindex 1eea4eab8b..7f76405921 100644--- a/datafusion/core/src/datasource/physical_plan/parquet/mod.rs+++ b/datafusion/core/src/datasource/physical_plan/parquet/mod.rs@@ -119,32 +119,32 @@ pub use writer::plan_to_parquet;/// Supports the following optimizations:////// * Concurrent reads: Can read from one or more files in parallel as multiple-/// partitions, including concurrently reading multiple row groups from a single-/// file.+/// partitions, including concurrently reading multiple row groups from a single+/// file.////// * Predicate push down: skips row groups and pages based on-/// min/max/null_counts in the row group metadata, the page index and bloom-/// filters.+/// min/max/null_counts in the row group metadata, the page index and bloom+/// filters.////// * Projection pushdown: reads and decodes only the columns required.////// * Limit pushdown: stop execution early after some number of rows are read.////// * Custom readers: customize reading parquet files, e.g. to cache metadata,-/// coalesce I/O operations, etc. See [`ParquetFileReaderFactory`] for more-/// details.+/// coalesce I/O operations, etc. See [`ParquetFileReaderFactory`] for more+/// details.////// * Schema adapters: read parquet files with different schemas into a unified-/// table schema. This can be used to implement "schema evolution". See-/// [`SchemaAdapterFactory`] for more details.+/// table schema. This can be used to implement "schema evolution". See+/// [`SchemaAdapterFactory`] for more details.////// * metadata_size_hint: controls the number of bytes read from the end of the-/// file in the initial I/O when the default [`ParquetFileReaderFactory`]. If a-/// custom reader is used, it supplies the metadata directly and this parameter-/// is ignored. [`ParquetExecBuilder::with_metadata_size_hint`] for more details.+/// file in the initial I/O when the default [`ParquetFileReaderFactory`]. If a+/// custom reader is used, it supplies the metadata directly and this parameter+/// is ignored. [`ParquetExecBuilder::with_metadata_size_hint`] for more details.////// * User provided [`ParquetAccessPlan`]s to skip row groups and/or pages-/// based on external information. See "Implementing External Indexes" below+/// based on external information. See "Implementing External Indexes" below////// # Implementing External Indexes///@@ -191,22 +191,22 @@ pub use writer::plan_to_parquet;/// # Execution Overview////// * Step 1: [`ParquetExec::execute`] is called, returning a [`FileStream`]-/// configured to open parquet files with a [`ParquetOpener`].+/// configured to open parquet files with a [`ParquetOpener`].////// * Step 2: When the stream is polled, the [`ParquetOpener`] is called to open-/// the file.+/// the file.////// * Step 3: The `ParquetOpener` gets the [`ParquetMetaData`] (file metadata)-/// via [`ParquetFileReaderFactory`], creating a [`ParquetAccessPlan`] by-/// applying predicates to metadata. The plan and projections are used to-/// determine what pages must be read.+/// via [`ParquetFileReaderFactory`], creating a [`ParquetAccessPlan`] by+/// applying predicates to metadata. The plan and projections are used to+/// determine what pages must be read.////// * Step 4: The stream begins reading data, fetching the required pages-/// and incrementally decoding them.+/// and incrementally decoding them.////// * Step 5: As each [`RecordBatch]` is read, it may be adapted by a-/// [`SchemaAdapter`] to match the table schema. By default missing columns are-/// filled with nulls, but this can be customized via [`SchemaAdapterFactory`].+/// [`SchemaAdapter`] to match the table schema. By default missing columns are+/// filled with nulls, but this can be customized via [`SchemaAdapterFactory`].////// [`RecordBatch`]: arrow::record_batch::RecordBatch/// [`SchemaAdapter`]: crate::datasource::schema_adapter::SchemaAdapterdiff --git a/datafusion/core/src/datasource/physical_plan/parquet/statistics.rs b/datafusion/core/src/datasource/physical_plan/parquet/statistics.rsindex 3d250718f7..11b8f5fc6c 100644--- a/datafusion/core/src/datasource/physical_plan/parquet/statistics.rs+++ b/datafusion/core/src/datasource/physical_plan/parquet/statistics.rs@@ -1358,14 +1358,14 @@ impl<'a> StatisticsConverter<'a> {/// # Parameters:////// * `column_page_index`: The parquet column page indices, read from- /// `ParquetMetaData` column_index+ /// `ParquetMetaData` column_index////// * `column_offset_index`: The parquet column offset indices, read from- /// `ParquetMetaData` offset_index+ /// `ParquetMetaData` offset_index////// * `row_group_indices`: The indices of the row groups, that are used to- /// extract the column page index and offset index on a per row group- /// per column basis.+ /// extract the column page index and offset index on a per row group+ /// per column basis.////// # Return Value///@@ -1486,13 +1486,13 @@ impl<'a> StatisticsConverter<'a> {/// # Parameters:////// * `column_offset_index`: The parquet column offset indices, read from- /// `ParquetMetaData` offset_index+ /// `ParquetMetaData` offset_index////// * `row_group_metadatas`: The metadata slice of the row groups, read- /// from `ParquetMetaData` row_groups+ /// from `ParquetMetaData` row_groups////// * `row_group_indices`: The indices of the row groups, that are used to- /// extract the column offset index on a per row group per column basis.+ /// extract the column offset index on a per row group per column basis.////// See docs on [`Self::data_page_mins`] for details.pub fn data_page_row_counts<I>(diff --git a/datafusion/core/src/execution/context/mod.rs b/datafusion/core/src/execution/context/mod.rsindex ac48788edb..18db4dc8eb 100644--- a/datafusion/core/src/execution/context/mod.rs+++ b/datafusion/core/src/execution/context/mod.rs@@ -205,21 +205,21 @@ where/// The objects are:////// 1. [`SessionContext`]: Most users should use a `SessionContext`. It contains-/// all information required to execute queries including high level APIs such-/// as [`SessionContext::sql`]. All queries run with the same `SessionContext`-/// share the same configuration and resources (e.g. memory limits).+/// all information required to execute queries including high level APIs such+/// as [`SessionContext::sql`]. All queries run with the same `SessionContext`+/// share the same configuration and resources (e.g. memory limits).////// 2. [`SessionState`]: contains information required to plan and execute an-/// individual query (e.g. creating a [`LogicalPlan`] or [`ExecutionPlan`]).-/// Each query is planned and executed using its own `SessionState`, which can-/// be created with [`SessionContext::state`]. `SessionState` allows finer-/// grained control over query execution, for example disallowing DDL operations-/// such as `CREATE TABLE`.+/// individual query (e.g. creating a [`LogicalPlan`] or [`ExecutionPlan`]).+/// Each query is planned and executed using its own `SessionState`, which can+/// be created with [`SessionContext::state`]. `SessionState` allows finer+/// grained control over query execution, for example disallowing DDL operations+/// such as `CREATE TABLE`.////// 3. [`TaskContext`] contains the state required for query execution (e.g.-/// [`ExecutionPlan::execute`]). It contains a subset of information in-/// [`SessionState`]. `TaskContext` allows executing [`ExecutionPlan`]s-/// [`PhysicalExpr`]s without requiring a full [`SessionState`].+/// [`ExecutionPlan::execute`]). It contains a subset of information in+/// [`SessionState`]. `TaskContext` allows executing [`ExecutionPlan`]s+/// [`PhysicalExpr`]s without requiring a full [`SessionState`].////// [`PhysicalExpr`]: crate::physical_expr::PhysicalExpr#[derive(Clone)]@@ -578,8 +578,8 @@ impl SessionContext {/// Create a [`PhysicalExpr`] from an [`Expr`] after applying type/// coercion and function rewrites.///- /// Note: The expression is not [simplified] or otherwise optimized: `a = 1- /// + 2` will not be simplified to `a = 3` as this is a more involved process.+ /// Note: The expression is not [simplified] or otherwise optimized:+ /// `a = 1 + 2` will not be simplified to `a = 3` as this is a more involved process./// See the [expr_api] example for how to simplify expressions.////// # Example@@ -980,6 +980,7 @@ impl SessionContext {////// - `SELECT MY_FUNC(x)...` will look for a function named `"my_func"`/// - `SELECT "my_FUNC"(x)` will look for a function named `"my_FUNC"`+ ////// Any functions registered with the udf name or its aliases will be overwritten with this new functionpub fn register_udf(&self, f: ScalarUDF) {let mut state = self.state.write();@@ -1324,11 +1325,11 @@ impl SessionContext {/// Notes:////// 1. `query_execution_start_time` is set to the current time for the- /// returned state.+ /// returned state.////// 2. The returned state is not shared with the current session state- /// and this changes to the returned `SessionState` such as changing- /// [`ConfigOptions`] will not be reflected in this `SessionContext`.+ /// and this changes to the returned `SessionState` such as changing+ /// [`ConfigOptions`] will not be reflected in this `SessionContext`.////// [`ConfigOptions`]: crate::config::ConfigOptionspub fn state(&self) -> SessionState {diff --git a/datafusion/core/src/execution/session_state.rs b/datafusion/core/src/execution/session_state.rsindex 59cc620dae..515888519f 100644--- a/datafusion/core/src/execution/session_state.rs+++ b/datafusion/core/src/execution/session_state.rs@@ -657,8 +657,8 @@ impl SessionState {/// Create a [`PhysicalExpr`] from an [`Expr`] after applying type/// coercion, and function rewrites.///- /// Note: The expression is not [simplified] or otherwise optimized: `a = 1- /// + 2` will not be simplified to `a = 3` as this is a more involved process.+ /// Note: The expression is not [simplified] or otherwise optimized:+ /// `a = 1 + 2` will not be simplified to `a = 3` as this is a more involved process./// See the [expr_api] example for how to simplify expressions.////// # See Also:diff --git a/datafusion/core/src/lib.rs b/datafusion/core/src/lib.rsindex d9ab9e1c07..59a1106462 100644--- a/datafusion/core/src/lib.rs+++ b/datafusion/core/src/lib.rs@@ -145,13 +145,13 @@//! DataFusion's Architecture Goals are://!//! 1. Work “out of the box”: Provide a very fast, world class query engine with-//! minimal setup or required configuration.+//! minimal setup or required configuration.//!//! 2. Customizable everything: All behavior should be customizable by-//! implementing traits.+//! implementing traits.//!//! 3. Architecturally boring 🥱: Follow industrial best practice rather than-//! trying cutting edge, but unproven, techniques.+//! trying cutting edge, but unproven, techniques.//!//! With these principles, users start with a basic, high-performance engine//! and specialize it over time to suit their needs and available engineering@@ -219,11 +219,11 @@//! ```//!//! 1. The query string is parsed to an Abstract Syntax Tree (AST)-//! [`Statement`] using [sqlparser].+//! [`Statement`] using [sqlparser].//!//! 2. The AST is converted to a [`LogicalPlan`] and logical-//! expressions [`Expr`]s to compute the desired result by the-//! [`SqlToRel`] planner.+//! expressions [`Expr`]s to compute the desired result by the+//! [`SqlToRel`] planner.//!//! [`Statement`]: https://docs.rs/sqlparser/latest/sqlparser/ast/enum.Statement.html//!@@ -255,17 +255,17 @@//! optimizing, in the following manner://!//! 1. The [`LogicalPlan`] is checked and rewritten to enforce-//! semantic rules, such as type coercion, by [`AnalyzerRule`]s+//! semantic rules, such as type coercion, by [`AnalyzerRule`]s//!//! 2. The [`LogicalPlan`] is rewritten by [`OptimizerRule`]s, such as-//! projection and filter pushdown, to improve its efficiency.+//! projection and filter pushdown, to improve its efficiency.//!//! 3. The [`LogicalPlan`] is converted to an [`ExecutionPlan`] by a-//! [`PhysicalPlanner`]+//! [`PhysicalPlanner`]//!//! 4. The [`ExecutionPlan`] is rewritten by-//! [`PhysicalOptimizerRule`]s, such as sort and join selection, to-//! improve its efficiency.+//! [`PhysicalOptimizerRule`]s, such as sort and join selection, to+//! improve its efficiency.//!//! ## Data Sources//!@@ -291,9 +291,9 @@//! an [`ExecutionPlan`]s for execution.//!//! 1. [`ListingTable`]: Reads data from Parquet, JSON, CSV, or AVRO-//! files. Supports single files or multiple files with HIVE style-//! partitioning, optional compression, directly reading from remote-//! object store and more.+//! files. Supports single files or multiple files with HIVE style+//! partitioning, optional compression, directly reading from remote+//! object store and more.//!//! 2. [`MemTable`]: Reads data from in memory [`RecordBatch`]es.//!@@ -425,13 +425,13 @@//! structures://!//! 1. [`SessionContext`]: State needed for create [`LogicalPlan`]s such-//! as the table definitions, and the function registries.+//! as the table definitions, and the function registries.//!//! 2. [`TaskContext`]: State needed for execution such as the-//! [`MemoryPool`], [`DiskManager`], and [`ObjectStoreRegistry`].+//! [`MemoryPool`], [`DiskManager`], and [`ObjectStoreRegistry`].//!//! 3. [`ExecutionProps`]: Per-execution properties and data (such as-//! starting timestamps, etc).+//! starting timestamps, etc).//!//! [`SessionContext`]: crate::execution::context::SessionContext//! [`TaskContext`]: crate::execution::context::TaskContextdiff --git a/datafusion/core/src/physical_optimizer/aggregate_statistics.rs b/datafusion/core/src/physical_optimizer/aggregate_statistics.rsindex 5f08e4512b..a8332d1d55 100644--- a/datafusion/core/src/physical_optimizer/aggregate_statistics.rs+++ b/datafusion/core/src/physical_optimizer/aggregate_statistics.rs@@ -103,6 +103,7 @@ impl PhysicalOptimizerRule for AggregateStatistics {/// assert if the node passed as argument is a final `AggregateExec` node that can be optimized:/// - its child (with possible intermediate layers) is a partial `AggregateExec` node/// - they both have no grouping expression+////// If this is the case, return a ref to the partial `AggregateExec`, else `None`./// We would have preferred to return a casted ref to AggregateExec but the recursion requires/// the `ExecutionPlan.children()` method that returns an owned reference.diff --git a/datafusion/core/src/physical_optimizer/enforce_distribution.rs b/datafusion/core/src/physical_optimizer/enforce_distribution.rsindex 62ac9089e2..acca2ed8d9 100644--- a/datafusion/core/src/physical_optimizer/enforce_distribution.rs+++ b/datafusion/core/src/physical_optimizer/enforce_distribution.rs@@ -856,6 +856,7 @@ fn add_roundrobin_on_top(/// Adds a hash repartition operator:/// - to increase parallelism, and/or/// - to satisfy requirements of the subsequent operators.+////// Repartition(Hash) is added on top of operator `input`.////// # Argumentsdiff --git a/datafusion/core/src/physical_optimizer/enforce_sorting.rs b/datafusion/core/src/physical_optimizer/enforce_sorting.rsindex e577c53360..cf9d33252a 100644--- a/datafusion/core/src/physical_optimizer/enforce_sorting.rs+++ b/datafusion/core/src/physical_optimizer/enforce_sorting.rs@@ -20,6 +20,7 @@//! - Adds a [`SortExec`] when a requirement is not met,//! - Removes an already-existing [`SortExec`] if it is possible to prove//! that this sort is unnecessary+//!//! The rule can work on valid *and* invalid physical plans with respect to//! sorting requirements, but always produces a valid physical plan in this sense.//!diff --git a/datafusion/core/src/physical_optimizer/pruning.rs b/datafusion/core/src/physical_optimizer/pruning.rsindex 3c18e53497..0ef390fff4 100644--- a/datafusion/core/src/physical_optimizer/pruning.rs+++ b/datafusion/core/src/physical_optimizer/pruning.rs@@ -173,10 +173,10 @@ pub trait PruningStatistics {/// 1. Arbitrary expressions (including user defined functions)////// 2. Vectorized evaluation (provide more than one set of statistics at a time)-/// so it is suitable for pruning 1000s of containers.+/// so it is suitable for pruning 1000s of containers.////// 3. Any source of information that implements the [`PruningStatistics`] trait-/// (not just Parquet metadata).+/// (not just Parquet metadata).////// # Example///@@ -278,17 +278,17 @@ pub trait PruningStatistics {/// 2. A predicate (expression that evaluates to a boolean)////// 3. [`PruningStatistics`] that provides information about columns in that-/// schema, for multiple “containers”. For each column in each container, it-/// provides optional information on contained values, min_values, max_values,-/// null_counts counts, and row_counts counts.+/// schema, for multiple “containers”. For each column in each container, it+/// provides optional information on contained values, min_values, max_values,+/// null_counts counts, and row_counts counts.////// **Outputs**:/// A (non null) boolean value for each container:/// * `true`: There MAY be rows that match the predicate////// * `false`: There are no rows that could possibly match the predicate (the-/// predicate can never possibly be true). The container can be pruned (skipped)-/// entirely.+/// predicate can never possibly be true). The container can be pruned (skipped)+/// entirely.////// Note that in order to be correct, `PruningPredicate` must return false/// **only** if it can determine that for all rows in the container, thediff --git a/datafusion/execution/src/memory_pool/mod.rs b/datafusion/execution/src/memory_pool/mod.rsindex 92ed1b2918..3df212d466 100644--- a/datafusion/execution/src/memory_pool/mod.rs+++ b/datafusion/execution/src/memory_pool/mod.rs@@ -78,10 +78,10 @@ pub use pool::*;/// * [`UnboundedMemoryPool`]: no memory limits (the default)////// * [`GreedyMemoryPool`]: Limits memory usage to a fixed size using a "first-/// come first served" policy+/// come first served" policy////// * [`FairSpillPool`]: Limits memory usage to a fixed size, allocating memory-/// to all spilling operators fairly+/// to all spilling operators fairlypub trait MemoryPool: Send + Sync + std::fmt::Debug {/// Registers a new [`MemoryConsumer`]///diff --git a/datafusion/execution/src/object_store.rs b/datafusion/execution/src/object_store.rsindex 9e1d94b346..cd75c9f3c4 100644--- a/datafusion/execution/src/object_store.rs+++ b/datafusion/execution/src/object_store.rs@@ -110,11 +110,11 @@ impl std::fmt::Display for ObjectStoreUrl {/// instances. For example DataFusion might be configured so that////// 1. `s3://my_bucket/lineitem/` mapped to the `/lineitem` path on an-/// AWS S3 object store bound to `my_bucket`+/// AWS S3 object store bound to `my_bucket`////// 2. `s3://my_other_bucket/lineitem/` mapped to the (same)-/// `/lineitem` path on a *different* AWS S3 object store bound to-/// `my_other_bucket`+/// `/lineitem` path on a *different* AWS S3 object store bound to+/// `my_other_bucket`////// When given a [`ListingTableUrl`], DataFusion tries to find an/// appropriate [`ObjectStore`]. For example@@ -127,21 +127,21 @@ impl std::fmt::Display for ObjectStoreUrl {/// [`ObjectStoreRegistry::get_store`] and one of three things will happen:////// - If an [`ObjectStore`] has been registered with [`ObjectStoreRegistry::register_store`] with-/// `s3://my_bucket`, that [`ObjectStore`] will be returned+/// `s3://my_bucket`, that [`ObjectStore`] will be returned////// - If an AWS S3 object store can be ad-hoc discovered by the url `s3://my_bucket/lineitem/`, this-/// object store will be registered with key `s3://my_bucket` and returned.+/// object store will be registered with key `s3://my_bucket` and returned.////// - Otherwise an error will be returned, indicating that no suitable [`ObjectStore`] could-/// be found+/// be found////// This allows for two different use-cases:////// 1. Systems where object store buckets are explicitly created using DDL, can register these-/// buckets using [`ObjectStoreRegistry::register_store`]+/// buckets using [`ObjectStoreRegistry::register_store`]////// 2. Systems relying on ad-hoc discovery, without corresponding DDL, can create [`ObjectStore`]-/// lazily by providing a custom implementation of [`ObjectStoreRegistry`]+/// lazily by providing a custom implementation of [`ObjectStoreRegistry`]////// <!-- is in a different crate so normal rustdoc links don't work -->/// [`ListingTableUrl`]: https://docs.rs/datafusion/latest/datafusion/datasource/listing/struct.ListingTableUrl.htmldiff --git a/datafusion/expr/src/accumulator.rs b/datafusion/expr/src/accumulator.rsindex 031348269a..f9af7850cb 100644--- a/datafusion/expr/src/accumulator.rs+++ b/datafusion/expr/src/accumulator.rs@@ -35,12 +35,12 @@ use std::fmt::Debug;/// * compute the final value from its internal state via [`evaluate`]////// * retract an update to its state from given inputs via-/// [`retract_batch`] (when used as a window aggregate [window-/// function])+/// [`retract_batch`] (when used as a window aggregate [window+/// function])////// * convert its internal state to a vector of aggregate values via-/// [`state`] and combine the state from multiple accumulators'-/// via [`merge_batch`], as part of efficient multi-phase grouping.+/// [`state`] and combine the state from multiple accumulators'+/// via [`merge_batch`], as part of efficient multi-phase grouping.////// [`GroupsAccumulator`]: crate::GroupsAccumulator/// [`update_batch`]: Self::update_batchdiff --git a/datafusion/expr/src/groups_accumulator.rs b/datafusion/expr/src/groups_accumulator.rsindex 2ffbfb266e..0d57c403bb 100644--- a/datafusion/expr/src/groups_accumulator.rs+++ b/datafusion/expr/src/groups_accumulator.rs@@ -84,13 +84,13 @@ pub trait GroupsAccumulator: Send {/// * `values`: the input arguments to the accumulator////// * `group_indices`: To which groups do the rows in `values`- /// belong, group id)+ /// belong, group id)////// * `opt_filter`: if present, only update aggregate state using- /// `values[i]` if `opt_filter[i]` is true+ /// `values[i]` if `opt_filter[i]` is true////// * `total_num_groups`: the number of groups (the largest- /// group_index is thus `total_num_groups - 1`).+ /// group_index is thus `total_num_groups - 1`).////// Note that subsequent calls to update_batch may have larger/// total_num_groups as new groups are seen.diff --git a/datafusion/expr/src/interval_arithmetic.rs b/datafusion/expr/src/interval_arithmetic.rsindex d0dd418c78..553cdd8c87 100644--- a/datafusion/expr/src/interval_arithmetic.rs+++ b/datafusion/expr/src/interval_arithmetic.rs@@ -989,7 +989,8 @@ fn div_bounds<const UPPER: bool>(/// results are converted to an *unbounded endpoint* if:/// - We are calculating an upper bound and we have a positive overflow./// - We are calculating a lower bound and we have a negative overflow.-/// Otherwise; the function sets the endpoint as:+///+/// Otherwise, the function sets the endpoint as:/// - The minimum representable number with the given datatype (`dt`) if/// we are calculating an upper bound and we have a negative overflow./// - The maximum representable number with the given datatype (`dt`) ifdiff --git a/datafusion/expr/src/logical_plan/plan.rs b/datafusion/expr/src/logical_plan/plan.rsindex d4fe233cac..54c857a2b7 100644--- a/datafusion/expr/src/logical_plan/plan.rs+++ b/datafusion/expr/src/logical_plan/plan.rs@@ -1910,19 +1910,19 @@ pub struct EmptyRelation {/// From the [Postgres Docs]:////// 1. Evaluate the non-recursive term. For `UNION` (but not `UNION ALL`),-/// discard duplicate rows. Include all remaining rows in the result of the-/// recursive query, and also place them in a temporary working table.-//+/// discard duplicate rows. Include all remaining rows in the result of the+/// recursive query, and also place them in a temporary working table.+////// 2. So long as the working table is not empty, repeat these steps:////// * Evaluate the recursive term, substituting the current contents of the-/// working table for the recursive self-reference. For `UNION` (but not `UNION-/// ALL`), discard duplicate rows and rows that duplicate any previous result-/// row. Include all remaining rows in the result of the recursive query, and-/// also place them in a temporary intermediate table.+/// working table for the recursive self-reference. For `UNION` (but not `UNION+/// ALL`), discard duplicate rows and rows that duplicate any previous result+/// row. Include all remaining rows in the result of the recursive query, and+/// also place them in a temporary intermediate table.////// * Replace the contents of the working table with the contents of the-/// intermediate table, then empty the intermediate table.+/// intermediate table, then empty the intermediate table.////// [Postgres Docs]: https://www.postgresql.org/docs/current/queries-with.html#QUERIES-WITH-RECURSIVE#[derive(Clone, PartialEq, Eq, Hash)]@@ -2003,7 +2003,7 @@ impl Projection {/// # Arguments////// * `input`: A reference to the input `LogicalPlan` for which the projection schema-/// will be computed.+/// will be computed./// * `exprs`: A slice of `Expr` expressions representing the projection operation to apply.////// # Returnsdiff --git a/datafusion/expr/src/simplify.rs b/datafusion/expr/src/simplify.rsindex ccf45ff0d0..a55cb49b1f 100644--- a/datafusion/expr/src/simplify.rs+++ b/datafusion/expr/src/simplify.rs@@ -74,7 +74,7 @@ impl<'a> SimplifyContext<'a> {impl<'a> SimplifyInfo for SimplifyContext<'a> {/// returns true if this Expr has boolean typefn is_boolean_type(&self, expr: &Expr) -> Result<bool> {- for schema in &self.schema {+ if let Some(schema) = &self.schema {if let Ok(DataType::Boolean) = expr.get_type(schema) {return Ok(true);}diff --git a/datafusion/expr/src/udaf.rs b/datafusion/expr/src/udaf.rsindex 8867a478f7..3f4a99749c 100644--- a/datafusion/expr/src/udaf.rs+++ b/datafusion/expr/src/udaf.rs@@ -56,7 +56,7 @@ use crate::{AccumulatorFactoryFunction, ReturnTypeFunction, Signature};/// 1. For simple use cases, use [`create_udaf`] (examples in [`simple_udaf.rs`]).////// 2. For advanced use cases, use [`AggregateUDFImpl`] which provides full API-/// access (examples in [`advanced_udaf.rs`]).+/// access (examples in [`advanced_udaf.rs`]).////// # API Note/// This is a separate struct from `AggregateUDFImpl` to maintain backwards@@ -346,9 +346,9 @@ pub trait AggregateUDFImpl: Debug + Send + Sync {/// # Arguments:/// 1. `name`: the name of the expression (e.g. AVG, SUM, etc)/// 2. `value_type`: Aggregate function output returned by [`Self::return_type`] if defined, otherwise- /// it is equivalent to the data type of the first arguments+ /// it is equivalent to the data type of the first arguments/// 3. `ordering_fields`: the fields used to order the input arguments, if any.- /// Empty if no ordering expression is provided.+ /// Empty if no ordering expression is provided.////// # Notes:///diff --git a/datafusion/expr/src/udf.rs b/datafusion/expr/src/udf.rsindex 1fbb3cc584..487b098ea2 100644--- a/datafusion/expr/src/udf.rs+++ b/datafusion/expr/src/udf.rs@@ -44,7 +44,7 @@ use crate::{/// 1. For simple use cases, use [`create_udf`] (examples in [`simple_udf.rs`]).////// 2. For advanced use cases, use [`ScalarUDFImpl`] which provides full API-/// access (examples in [`advanced_udf.rs`]).+/// access (examples in [`advanced_udf.rs`]).////// # API Note///diff --git a/datafusion/expr/src/udwf.rs b/datafusion/expr/src/udwf.rsindex 5abce013df..9e6d963ccf 100644--- a/datafusion/expr/src/udwf.rs+++ b/datafusion/expr/src/udwf.rs@@ -40,10 +40,10 @@ use crate::{/// See the documentation on [`PartitionEvaluator`] for more details////// 1. For simple use cases, use [`create_udwf`] (examples in-/// [`simple_udwf.rs`]).+/// [`simple_udwf.rs`]).////// 2. For advanced use cases, use [`WindowUDFImpl`] which provides full API-/// access (examples in [`advanced_udwf.rs`]).+/// access (examples in [`advanced_udwf.rs`]).////// # API Note/// This is a separate struct from `WindowUDFImpl` to maintain backwardsdiff --git a/datafusion/expr/src/window_frame.rs b/datafusion/expr/src/window_frame.rsindex 5b2f8982a5..0e1d917419 100644--- a/datafusion/expr/src/window_frame.rs+++ b/datafusion/expr/src/window_frame.rs@@ -303,11 +303,11 @@ impl WindowFrame {#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub enum WindowFrameBound {/// 1. UNBOUNDED PRECEDING- /// The frame boundary is the first row in the partition.+ /// The frame boundary is the first row in the partition.////// 2. `<expr>` PRECEDING- /// `<expr>` must be a non-negative constant numeric expression. The boundary is a row that- /// is `<expr>` "units" prior to the current row.+ /// `<expr>` must be a non-negative constant numeric expression. The boundary is a row that+ /// is `<expr>` "units" prior to the current row.Preceding(ScalarValue),/// 3. The current row.///@@ -317,10 +317,10 @@ pub enum WindowFrameBound {/// boundary.CurrentRow,/// 4. This is the same as "`<expr>` PRECEDING" except that the boundary is `<expr>` units after the- /// current rather than before the current row.+ /// current rather than before the current row.////// 5. UNBOUNDED FOLLOWING- /// The frame boundary is the last row in the partition.+ /// The frame boundary is the last row in the partition.Following(ScalarValue),}diff --git a/datafusion/functions-aggregate/src/lib.rs b/datafusion/functions-aggregate/src/lib.rsindex 32ca05b8cd..1711869666 100644--- a/datafusion/functions-aggregate/src/lib.rs+++ b/datafusion/functions-aggregate/src/lib.rs@@ -52,7 +52,7 @@//! 3. Add a new feature to `Cargo.toml`, with any optional dependencies//!//! 4. Use the `make_package!` macro to expose the module when the-//! feature is enabled.+//! feature is enabled.#[macro_use]pub mod macros;diff --git a/datafusion/functions/src/lib.rs b/datafusion/functions/src/lib.rsindex b1c55c843f..81be555266 100644--- a/datafusion/functions/src/lib.rs+++ b/datafusion/functions/src/lib.rs@@ -76,7 +76,7 @@//! 3. Add a new feature to `Cargo.toml`, with any optional dependencies//!//! 4. Use the `make_package!` macro to expose the module when the-//! feature is enabled.+//! feature is enabled.//!//! [`ScalarUDF`]: datafusion_expr::ScalarUDFuse datafusion_common::Result;diff --git a/datafusion/optimizer/src/analyzer/subquery.rs b/datafusion/optimizer/src/analyzer/subquery.rsindex 9856ea271c..78be48a189 100644--- a/datafusion/optimizer/src/analyzer/subquery.rs+++ b/datafusion/optimizer/src/analyzer/subquery.rs@@ -35,8 +35,8 @@ use datafusion_expr::{/// the allowed while list: [Projection, Filter, Window, Aggregate, Join]./// 2) Check whether the inner plan is in the allowed inner plans list to use correlated(outer) expressions./// 3) Check and validate unsupported cases to use the correlated(outer) expressions inside the subquery(inner) plans/inner expressions.-/// For example, we do not want to support to use correlated expressions as the Join conditions in the subquery plan when the Join-/// is a Full Out Join+/// For example, we do not want to support to use correlated expressions as the Join conditions in the subquery plan when the Join+/// is a Full Out Joinpub fn check_subquery_expr(outer_plan: &LogicalPlan,inner_plan: &LogicalPlan,diff --git a/datafusion/optimizer/src/common_subexpr_eliminate.rs b/datafusion/optimizer/src/common_subexpr_eliminate.rsindex bbf2091c22..70ca6f5304 100644--- a/datafusion/optimizer/src/common_subexpr_eliminate.rs+++ b/datafusion/optimizer/src/common_subexpr_eliminate.rs@@ -599,7 +599,7 @@ impl CommonSubexprEliminate {////// 1. The original `input` of no common subexpressions were extracted/// 2. A newly added projection on top of the original input- /// that computes the common subexpressions+ /// that computes the common subexpressionsfn try_unary_plan(&self,expr: Vec<Expr>,diff --git a/datafusion/optimizer/src/lib.rs b/datafusion/optimizer/src/lib.rsindex 332d3e9fe5..3b1df3510d 100644--- a/datafusion/optimizer/src/lib.rs+++ b/datafusion/optimizer/src/lib.rs@@ -22,11 +22,11 @@//! Contains rules for rewriting [`LogicalPlan`]s//!//! 1. [`Analyzer`] applies [`AnalyzerRule`]s to transform `LogicalPlan`s-//! to make the plan valid prior to the rest of the DataFusion optimization-//! process (for example, [`TypeCoercion`]).+//! to make the plan valid prior to the rest of the DataFusion optimization+//! process (for example, [`TypeCoercion`]).//!//! 2. [`Optimizer`] applies [`OptimizerRule`]s to transform `LogicalPlan`s-//! into equivalent, but more efficient plans.+//! into equivalent, but more efficient plans.//!//! [`LogicalPlan`]: datafusion_expr::LogicalPlan//! [`TypeCoercion`]: analyzer::type_coercion::TypeCoerciondiff --git a/datafusion/optimizer/src/push_down_filter.rs b/datafusion/optimizer/src/push_down_filter.rsindex ad9be449d9..ecad3404d5 100644--- a/datafusion/optimizer/src/push_down_filter.rs+++ b/datafusion/optimizer/src/push_down_filter.rs@@ -557,7 +557,7 @@ fn push_down_join(/// * `predicates` the pushed down filter expression////// * `on_filters` filters from the join ON clause that have not already been-/// identified as join predicates+/// identified as join predicates///fn infer_join_predicates(join: &Join,diff --git a/datafusion/optimizer/src/simplify_expressions/guarantees.rs b/datafusion/optimizer/src/simplify_expressions/guarantees.rsindex 2ccf93e2d5..09fdd7685a 100644--- a/datafusion/optimizer/src/simplify_expressions/guarantees.rs+++ b/datafusion/optimizer/src/simplify_expressions/guarantees.rs@@ -170,7 +170,7 @@ impl<'a> TreeNodeRewriter for GuaranteeRewriter<'a> {.filter_map(|expr| {if let Expr::Literal(item) = expr {match interval- .contains(&NullableInterval::from(item.clone()))+ .contains(NullableInterval::from(item.clone())){// If we know for certain the value isn't in the column's interval,// we can skip checking it.diff --git a/datafusion/optimizer/src/simplify_expressions/regex.rs b/datafusion/optimizer/src/simplify_expressions/regex.rsindex 9a78298b10..6c99f18ab0 100644--- a/datafusion/optimizer/src/simplify_expressions/regex.rs+++ b/datafusion/optimizer/src/simplify_expressions/regex.rs@@ -216,6 +216,7 @@ fn is_anchored_capture(v: &[Hir]) -> bool {/// Returns the `LIKE` pattern if the `Concat` pattern is partial anchored:/// - `[Look::Start, Literal(_)]`/// - `[Literal(_), Look::End]`+////// Full anchored patterns are handled by [`anchored_literal_to_expr`].fn partial_anchored_literal_to_like(v: &[Hir]) -> Option<String> {if v.len() != 2 {diff --git a/datafusion/physical-expr-common/src/aggregate/utils.rs b/datafusion/physical-expr-common/src/aggregate/utils.rsindex bcd0d05be0..9e380bd820 100644--- a/datafusion/physical-expr-common/src/aggregate/utils.rs+++ b/datafusion/physical-expr-common/src/aggregate/utils.rs@@ -207,7 +207,7 @@ impl<T: DecimalType> DecimalAverager<T> {/// target_scale and target_precision and reporting overflow.////// * sum: The total sum value stored as Decimal128 with sum_scale- /// (passed to `Self::try_new`)+ /// (passed to `Self::try_new`)/// * count: total count, stored as a i128/i256 (*NOT* a Decimal128/Decimal256 value)#[inline(always)]pub fn avg(&self, sum: T::Native, count: T::Native) -> Result<T::Native> {diff --git a/datafusion/physical-expr-common/src/binary_map.rs b/datafusion/physical-expr-common/src/binary_map.rsindex 2328070101..a5da05d2a5 100644--- a/datafusion/physical-expr-common/src/binary_map.rs+++ b/datafusion/physical-expr-common/src/binary_map.rs@@ -113,13 +113,13 @@ impl<O: OffsetSizeTrait> ArrowBytesSet<O> {/// This is a specialized HashMap with the following properties:////// 1. Optimized for storing and emitting Arrow byte types (e.g.-/// `StringArray` / `BinaryArray`) very efficiently by minimizing copying of-/// the string values themselves, both when inserting and when emitting the-/// final array.+/// `StringArray` / `BinaryArray`) very efficiently by minimizing copying of+/// the string values themselves, both when inserting and when emitting the+/// final array.///////// 2. Retains the insertion order of entries in the final array. The values are-/// in the same order as they were inserted.+/// in the same order as they were inserted.////// Note this structure can be used as a `HashSet` by specifying the value type/// as `()`, as is done by [`ArrowBytesSet`].@@ -134,18 +134,18 @@ impl<O: OffsetSizeTrait> ArrowBytesSet<O> {/// "Foo", NULL, "Bar", "TheQuickBrownFox":////// * `hashtable` stores entries for each distinct string that has been-/// inserted. The entries contain the payload as well as information about the-/// value (either an offset or the actual bytes, see `Entry` docs for more-/// details)+/// inserted. The entries contain the payload as well as information about the+/// value (either an offset or the actual bytes, see `Entry` docs for more+/// details)////// * `offsets` stores offsets into `buffer` for each distinct string value,-/// following the same convention as the offsets in a `StringArray` or-/// `LargeStringArray`.+/// following the same convention as the offsets in a `StringArray` or+/// `LargeStringArray`.////// * `buffer` stores the actual byte data////// * `null`: stores the index and payload of the null value, in this case the-/// second value (index 1)+/// second value (index 1)////// ```text/// ┌───────────────────────────────────┐ ┌─────┐ ┌────┐diff --git a/datafusion/physical-expr-common/src/physical_expr.rs b/datafusion/physical-expr-common/src/physical_expr.rsindex c74fb9c2d1..e62606a42e 100644--- a/datafusion/physical-expr-common/src/physical_expr.rs+++ b/datafusion/physical-expr-common/src/physical_expr.rs@@ -81,7 +81,7 @@ pub trait PhysicalExpr: Send + Sync + Display + Debug + PartialEq<dyn Any> {/// # Arguments////// * `children` are the intervals for the children (inputs) of this- /// expression.+ /// expression.////// # Example///diff --git a/datafusion/physical-expr/src/equivalence/properties.rs b/datafusion/physical-expr/src/equivalence/properties.rsindex 64c22064d4..a6e9fba281 100644--- a/datafusion/physical-expr/src/equivalence/properties.rs+++ b/datafusion/physical-expr/src/equivalence/properties.rs@@ -1056,22 +1056,22 @@ impl EquivalenceProperties {////// Order information can be retrieved as:/// - If it is a leaf node, we directly find the order of the node by looking-/// at the given sort expression and equivalence properties if it is a `Column`-/// leaf, or we mark it as unordered. In the case of a `Literal` leaf, we mark-/// it as singleton so that it can cooperate with all ordered columns.+/// at the given sort expression and equivalence properties if it is a `Column`+/// leaf, or we mark it as unordered. In the case of a `Literal` leaf, we mark+/// it as singleton so that it can cooperate with all ordered columns./// - If it is an intermediate node, the children states matter. Each `PhysicalExpr`-/// and operator has its own rules on how to propagate the children orderings.-/// However, before we engage in recursion, we check whether this intermediate-/// node directly matches with the sort expression. If there is a match, the-/// sort expression emerges at that node immediately, discarding the recursive-/// result coming from its children.+/// and operator has its own rules on how to propagate the children orderings.+/// However, before we engage in recursion, we check whether this intermediate+/// node directly matches with the sort expression. If there is a match, the+/// sort expression emerges at that node immediately, discarding the recursive+/// result coming from its children.////// Range information is calculated as:/// - If it is a `Literal` node, we set the range as a point value. If it is a-/// `Column` node, we set the datatype of the range, but cannot give an interval-/// for the range, yet.+/// `Column` node, we set the datatype of the range, but cannot give an interval+/// for the range, yet./// - If it is an intermediate node, the children states matter. Each `PhysicalExpr`-/// and operator has its own rules on how to propagate the children range.+/// and operator has its own rules on how to propagate the children range.fn update_properties(mut node: ExprPropertiesNode,eq_properties: &EquivalenceProperties,diff --git a/datafusion/physical-expr/src/utils/guarantee.rs b/datafusion/physical-expr/src/utils/guarantee.rsindex 993ff56100..4385066529 100644--- a/datafusion/physical-expr/src/utils/guarantee.rs+++ b/datafusion/physical-expr/src/utils/guarantee.rs@@ -62,14 +62,14 @@ use std::sync::Arc;/// A guarantee can be one of two forms:////// 1. The column must be one the values for the predicate to be `true`. If the-/// column takes on any other value, the predicate can not evaluate to `true`.-/// For example,-/// `(a = 1)`, `(a = 1 OR a = 2)` or `a IN (1, 2, 3)`+/// column takes on any other value, the predicate can not evaluate to `true`.+/// For example,+/// `(a = 1)`, `(a = 1 OR a = 2)` or `a IN (1, 2, 3)`////// 2. The column must NOT be one of the values for the predicate to be `true`.-/// If the column can ONLY take one of these values, the predicate can not-/// evaluate to `true`. For example,-/// `(a != 1)`, `(a != 1 AND a != 2)` or `a NOT IN (1, 2, 3)`+/// If the column can ONLY take one of these values, the predicate can not+/// evaluate to `true`. For example,+/// `(a != 1)`, `(a != 1 AND a != 2)` or `a NOT IN (1, 2, 3)`#[derive(Debug, Clone, PartialEq)]pub struct LiteralGuarantee {pub column: Column,@@ -374,6 +374,7 @@ impl<'a> ColOpLit<'a> {/// 1. `col <op> literal`/// 2. `literal <op> col`/// 3. operator is `=` or `!=`+ ////// Returns None otherwisefn try_new(expr: &'a Arc<dyn PhysicalExpr>) -> Option<Self> {let binary_expr = exprdiff --git a/datafusion/physical-plan/Cargo.toml b/datafusion/physical-plan/Cargo.tomlindex 00fc81ebde..d3f66bdea9 100644--- a/datafusion/physical-plan/Cargo.toml+++ b/datafusion/physical-plan/Cargo.toml@@ -31,6 +31,9 @@ rust-version = { workspace = true }[lints]workspace = true+[features]+force_hash_collisions = []+[lib]name = "datafusion_physical_plan"path = "src/lib.rs"diff --git a/datafusion/physical-plan/src/aggregates/order/mod.rs b/datafusion/physical-plan/src/aggregates/order/mod.rsindex 556103e1e2..1d94d56df1 100644--- a/datafusion/physical-plan/src/aggregates/order/mod.rs+++ b/datafusion/physical-plan/src/aggregates/order/mod.rs@@ -87,7 +87,7 @@ impl GroupOrdering {/// Called when new groups are added in a batch////// * `total_num_groups`: total number of groups (so max- /// group_index is total_num_groups - 1).+ /// group_index is total_num_groups - 1).////// * `group_values`: group key values for *each row* in the batch///diff --git a/datafusion/physical-plan/src/joins/hash_join.rs b/datafusion/physical-plan/src/joins/hash_join.rsindex 16b3a4f2fe..4ed4d9ba25 100644--- a/datafusion/physical-plan/src/joins/hash_join.rs+++ b/datafusion/physical-plan/src/joins/hash_join.rs@@ -180,9 +180,9 @@ impl JoinLeftData {/// Execution proceeds in 2 stages:////// 1. the **build phase** creates a hash table from the tuples of the build side,-/// and single concatenated batch containing data from all fetched record batches.-/// Resulting hash table stores hashed join-key fields for each row as a key, and-/// indices of corresponding rows in concatenated batch.+/// and single concatenated batch containing data from all fetched record batches.+/// Resulting hash table stores hashed join-key fields for each row as a key, and+/// indices of corresponding rows in concatenated batch.////// Hash join uses LIFO data structure as a hash table, and in order to retain/// original build-side input order while obtaining data during probe phase, hash@@ -223,7 +223,7 @@ impl JoinLeftData {/// ```////// 2. the **probe phase** where the tuples of the probe side are streamed-/// through, checking for matches of the join keys in the hash table.+/// through, checking for matches of the join keys in the hash table.////// ```text/// ┌────────────────┐ ┌────────────────┐@@ -1092,7 +1092,7 @@ impl ProcessProbeBatchState {/// 1. Reads the entire left input (build) and constructs a hash table////// 2. Streams [RecordBatch]es as they arrive from the right input (probe) and joins-/// them with the contents of the hash table+/// them with the contents of the hash tablestruct HashJoinStream {/// Input schemaschema: Arc<Schema>,@@ -1583,6 +1583,7 @@ mod tests {use rstest::*;use rstest_reuse::*;+ #[cfg(not(feature = "force_hash_collisions"))]fn div_ceil(a: usize, b: usize) -> usize {(a + b - 1) / b}@@ -1930,6 +1931,8 @@ mod tests {Ok(())}+ // FIXME(#TODO) test fails with feature `force_hash_collisions`+ #[cfg(not(feature = "force_hash_collisions"))]#[apply(batch_sizes)]#[tokio::test]async fn join_inner_two(batch_size: usize) -> Result<()> {@@ -1985,6 +1988,8 @@ mod tests {}/// Test where the left has 2 parts, the right with 1 part => 1 part+ // FIXME(#TODO) test fails with feature `force_hash_collisions`+ #[cfg(not(feature = "force_hash_collisions"))]#[apply(batch_sizes)]#[tokio::test]async fn join_inner_one_two_parts_left(batch_size: usize) -> Result<()> {@@ -2097,6 +2102,8 @@ mod tests {}/// Test where the left has 1 part, the right has 2 parts => 2 parts+ // FIXME(#TODO) test fails with feature `force_hash_collisions`+ #[cfg(not(feature = "force_hash_collisions"))]#[apply(batch_sizes)]#[tokio::test]async fn join_inner_one_two_parts_right(batch_size: usize) -> Result<()> {diff --git a/datafusion/physical-plan/src/joins/symmetric_hash_join.rs b/datafusion/physical-plan/src/joins/symmetric_hash_join.rsindex 2299b7ff07..1bf2ef2fd5 100644--- a/datafusion/physical-plan/src/joins/symmetric_hash_join.rs+++ b/datafusion/physical-plan/src/joins/symmetric_hash_join.rs@@ -94,7 +94,7 @@ const HASHMAP_SHRINK_SCALE_FACTOR: usize = 4;/// - If so record the visited rows. If the matched row results must be produced (INNER, LEFT), output the [RecordBatch]./// - Try to prune other side (probe) with new [RecordBatch]./// - If the join type indicates that the unmatched rows results must be produced (LEFT, FULL etc.),-/// output the [RecordBatch] when a pruning happens or at the end of the data.+/// output the [RecordBatch] when a pruning happens or at the end of the data.///////// ``` text@@ -584,7 +584,7 @@ impl Stream for SymmetricHashJoinStream {////// * `buffer`: The record batch to be pruned./// * `build_side_filter_expr`: The filter expression on the build side used-/// to determine the pruning length.+/// to determine the pruning length.////// # Returns///diff --git a/datafusion/physical-plan/src/sorts/sort.rs b/datafusion/physical-plan/src/sorts/sort.rsindex 13ff63c174..5e82c6dab8 100644--- a/datafusion/physical-plan/src/sorts/sort.rs+++ b/datafusion/physical-plan/src/sorts/sort.rs@@ -90,14 +90,14 @@ impl ExternalSorterMetrics {/// 1. get a non-empty new batch from input////// 2. check with the memory manager there is sufficient space to-/// buffer the batch in memory 2.1 if memory sufficient, buffer-/// batch in memory, go to 1.+/// buffer the batch in memory 2.1 if memory sufficient, buffer+/// batch in memory, go to 1.////// 2.2 if no more memory is available, sort all buffered batches and/// spill to file. buffer the next batch in memory, go to 1.////// 3. when input is exhausted, merge all in memory batches and spills-/// to get a total order.+/// to get a total order.////// # When data fits in available memory///@@ -321,7 +321,7 @@ impl ExternalSorter {/// 1. An in-memory sort/merge (if the input fit in memory)////// 2. A combined streaming merge incorporating both in-memory- /// batches and data from spill files on disk.+ /// batches and data from spill files on disk.fn sort(&mut self) -> Result<SendableRecordBatchStream> {if self.spilled_before() {let mut streams = vec![];diff --git a/datafusion/physical-plan/src/unnest.rs b/datafusion/physical-plan/src/unnest.rsindex bdd56f4b5a..67c2aaedbe 100644--- a/datafusion/physical-plan/src/unnest.rs+++ b/datafusion/physical-plan/src/unnest.rs@@ -341,8 +341,9 @@ fn flatten_struct_cols(/// For each row in a `RecordBatch`, some list/struct columns need to be unnested./// - For list columns: We will expand the values in each list into multiple rows,-/// taking the longest length among these lists, and shorter lists are padded with NULLs.+/// taking the longest length among these lists, and shorter lists are padded with NULLs./// - For struct columns: We will expand the struct columns into multiple subfield columns.+////// For columns that don't need to be unnested, repeat their values until reaching the longest length.fn build_batch(batch: &RecordBatch,diff --git a/datafusion/physical-plan/src/windows/mod.rs b/datafusion/physical-plan/src/windows/mod.rsindex ffe558e215..a462430ca3 100644--- a/datafusion/physical-plan/src/windows/mod.rs+++ b/datafusion/physical-plan/src/windows/mod.rs@@ -579,6 +579,7 @@ pub fn get_best_fitting_window(/// (input ordering is not sufficient to run current window executor)./// - A `Some((bool, InputOrderMode))` value indicates that the window operator/// can run with existing input ordering, so we can remove `SortExec` before it.+////// The `bool` field in the return value represents whether we should reverse window/// operator to remove `SortExec` before it. The `InputOrderMode` field represents/// the mode this window operator should work in to accommodate the existing ordering.diff --git a/datafusion/sql/src/lib.rs b/datafusion/sql/src/lib.rsindex f53cab5df8..956f5e17e2 100644--- a/datafusion/sql/src/lib.rs+++ b/datafusion/sql/src/lib.rs@@ -20,13 +20,13 @@//! This crate provides://!//! 1. A SQL parser, [`DFParser`], that translates SQL query text into-//! an abstract syntax tree (AST), [`Statement`].+//! an abstract syntax tree (AST), [`Statement`].//!//! 2. A SQL query planner [`SqlToRel`] that creates [`LogicalPlan`]s-//! from [`Statement`]s.+//! from [`Statement`]s.//!//! 3. A SQL [`unparser`] that converts [`Expr`]s and [`LogicalPlan`]s-//! into SQL query text.+//! into SQL query text.//!//! [`DFParser`]: parser::DFParser//! [`Statement`]: parser::Statementdiff --git a/datafusion/sql/src/parser.rs b/datafusion/sql/src/parser.rsindex a743aa7282..5a774a2397 100644--- a/datafusion/sql/src/parser.rs+++ b/datafusion/sql/src/parser.rs@@ -1526,10 +1526,10 @@ mod tests {/// that:////// 1. parsing `sql` results in the same [`Statement`] as parsing- /// `canonical`.+ /// `canonical`.////// 2. re-serializing the result of parsing `sql` produces the same- /// `canonical` sql string+ /// `canonical` sql stringfn one_statement_parses_to(sql: &str, canonical: &str) -> Statement {let mut statements = DFParser::parse_sql(sql).unwrap();assert_eq!(statements.len(), 1);diff --git a/datafusion/sql/src/utils.rs b/datafusion/sql/src/utils.rsindex a70e3e9be9..483b8093a0 100644--- a/datafusion/sql/src/utils.rs+++ b/datafusion/sql/src/utils.rs@@ -268,6 +268,7 @@ pub(crate) fn normalize_ident(id: Ident) -> String {/// Try transform depends on unnest type/// - For list column: unnest(col) with type list -> unnest(col) with type list::item/// - For struct column: unnest(struct(field1, field2)) -> unnest(struct).field1, unnest(struct).field2+////// The transformed exprs will be used in the outer projection/// If along the path from root to bottom, there are multiple unnest expressions, the transformation/// is done only for the bottom expressiondiff --git a/datafusion/sqllogictest/test_files/parquet.slt b/datafusion/sqllogictest/test_files/parquet.sltindex e70f800bde..553cdeee90 100644--- a/datafusion/sqllogictest/test_files/parquet.slt+++ b/datafusion/sqllogictest/test_files/parquet.slt@@ -251,25 +251,26 @@ SELECT COUNT(*) FROM timestamp_with_tz;----131072+# FIXME(#TODO) fails with feature `force_hash_collisions`# Perform the query:-query IPT-SELECT- count,- LAG(timestamp, 1) OVER (ORDER BY timestamp),- arrow_typeof(LAG(timestamp, 1) OVER (ORDER BY timestamp))-FROM timestamp_with_tz-LIMIT 10;------0 NULL Timestamp(Millisecond, Some("UTC"))-0 2014-08-27T14:00:00Z Timestamp(Millisecond, Some("UTC"))-0 2014-08-27T14:00:00Z Timestamp(Millisecond, Some("UTC"))-4 2014-08-27T14:00:00Z Timestamp(Millisecond, Some("UTC"))-0 2014-08-27T14:00:00Z Timestamp(Millisecond, Some("UTC"))-0 2014-08-27T14:00:00Z Timestamp(Millisecond, Some("UTC"))-0 2014-08-27T14:00:00Z Timestamp(Millisecond, Some("UTC"))-14 2014-08-27T14:00:00Z Timestamp(Millisecond, Some("UTC"))-0 2014-08-27T14:00:00Z Timestamp(Millisecond, Some("UTC"))-0 2014-08-27T14:00:00Z Timestamp(Millisecond, Some("UTC"))+# query IPT+# SELECT+# count,+# LAG(timestamp, 1) OVER (ORDER BY timestamp),+# arrow_typeof(LAG(timestamp, 1) OVER (ORDER BY timestamp))+# FROM timestamp_with_tz+# LIMIT 10;+# ----+# 0 NULL Timestamp(Millisecond, Some("UTC"))+# 0 2014-08-27T14:00:00Z Timestamp(Millisecond, Some("UTC"))+# 0 2014-08-27T14:00:00Z Timestamp(Millisecond, Some("UTC"))+# 4 2014-08-27T14:00:00Z Timestamp(Millisecond, Some("UTC"))+# 0 2014-08-27T14:00:00Z Timestamp(Millisecond, Some("UTC"))+# 0 2014-08-27T14:00:00Z Timestamp(Millisecond, Some("UTC"))+# 0 2014-08-27T14:00:00Z Timestamp(Millisecond, Some("UTC"))+# 14 2014-08-27T14:00:00Z Timestamp(Millisecond, Some("UTC"))+# 0 2014-08-27T14:00:00Z Timestamp(Millisecond, Some("UTC"))+# 0 2014-08-27T14:00:00Z Timestamp(Millisecond, Some("UTC"))# Test config listing_table_ignore_subdirectory:diff --git a/datafusion/sqllogictest/test_files/sort_merge_join.slt b/datafusion/sqllogictest/test_files/sort_merge_join.sltindex 5a6334602c..bebec31b90 100644--- a/datafusion/sqllogictest/test_files/sort_merge_join.slt+++ b/datafusion/sqllogictest/test_files/sort_merge_join.slt@@ -238,16 +238,17 @@ SELECT * FROM t1 FULL JOIN t2 ON t1_id = t2_id44 d 4 44 x 3NULL NULL NULL 55 w 3+# FIXME(#TODO) fails with feature `force_hash_collisions`# equijoin_full_and_condition_from_both-query ITIITI rowsort-SELECT * FROM t1 FULL JOIN t2 ON t1_id = t2_id AND t2_int <= t1_int------11 a 1 NULL NULL NULL-22 b 2 22 y 1-33 c 3 NULL NULL NULL-44 d 4 44 x 3-NULL NULL NULL 11 z 3-NULL NULL NULL 55 w 3+# query ITIITI rowsort+# SELECT * FROM t1 FULL JOIN t2 ON t1_id = t2_id AND t2_int <= t1_int+# ----+# 11 a 1 NULL NULL NULL+# 22 b 2 22 y 1+# 33 c 3 NULL NULL NULL+# 44 d 4 44 x 3+# NULL NULL NULL 11 z 3+# NULL NULL NULL 55 w 3statement okDROP TABLE t1;diff --git a/datafusion/substrait/src/logical_plan/consumer.rs b/datafusion/substrait/src/logical_plan/consumer.rsindex 15c4471148..eebadb239d 100644--- a/datafusion/substrait/src/logical_plan/consumer.rs+++ b/datafusion/substrait/src/logical_plan/consumer.rs@@ -151,6 +151,7 @@ fn split_eq_and_noneq_join_predicate_with_nulls_equality(let mut nulls_equal_nulls = false;for expr in exprs {+ #[allow(clippy::collapsible_match)]match expr {Expr::BinaryExpr(binary_expr) => match binary_expr {x @ (BinaryExpr {