Skip to content

Commit 606dfd2

Browse files
chore: Format examples in doc strings - catalog listing (#18335)
## 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 datafusion-catalog-listing -- --config format_code_in_doc_comments=true` ## 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. Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
1 parent c268106 commit 606dfd2

File tree

2 files changed

+14
-27
lines changed

2 files changed

+14
-27
lines changed

datafusion/catalog-listing/src/config.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ pub enum SchemaSource {
5353
///
5454
/// If not specified, a [`datafusion_datasource::schema_adapter::DefaultSchemaAdapterFactory`]
5555
/// will be used, which handles basic schema compatibility cases.
56-
///
5756
#[derive(Debug, Clone, Default)]
5857
pub struct ListingTableConfig {
5958
/// Paths on the `ObjectStore` for creating [`crate::ListingTable`].
@@ -160,8 +159,8 @@ impl ListingTableConfig {
160159
/// .with_file_extension(".parquet")
161160
/// .with_collect_stat(true);
162161
///
163-
/// let config = ListingTableConfig::new(table_paths)
164-
/// .with_listing_options(options); // Configure file format and options
162+
/// let config = ListingTableConfig::new(table_paths).with_listing_options(options);
163+
/// // Configure file format and options
165164
/// ```
166165
pub fn with_listing_options(self, listing_options: ListingOptions) -> Self {
167166
// Note: This method properly sets options, but be aware that downstream

datafusion/catalog-listing/src/options.rs

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,8 @@ impl ListingOptions {
100100
/// # use datafusion_catalog_listing::ListingOptions;
101101
/// # use datafusion_datasource_parquet::file_format::ParquetFormat;
102102
///
103-
/// let listing_options = ListingOptions::new(Arc::new(
104-
/// ParquetFormat::default()
105-
/// ))
106-
/// .with_file_extension(".parquet");
103+
/// let listing_options = ListingOptions::new(Arc::new(ParquetFormat::default()))
104+
/// .with_file_extension(".parquet");
107105
///
108106
/// assert_eq!(listing_options.file_extension, ".parquet");
109107
/// ```
@@ -123,10 +121,8 @@ impl ListingOptions {
123121
/// # use datafusion_datasource_parquet::file_format::ParquetFormat;
124122
///
125123
/// let extension = Some(".parquet");
126-
/// let listing_options = ListingOptions::new(Arc::new(
127-
/// ParquetFormat::default()
128-
/// ))
129-
/// .with_file_extension_opt(extension);
124+
/// let listing_options = ListingOptions::new(Arc::new(ParquetFormat::default()))
125+
/// .with_file_extension_opt(extension);
130126
///
131127
/// assert_eq!(listing_options.file_extension, ".parquet");
132128
/// ```
@@ -216,10 +212,8 @@ impl ListingOptions {
216212
/// # use datafusion_catalog_listing::ListingOptions;
217213
/// # use datafusion_datasource_parquet::file_format::ParquetFormat;
218214
///
219-
/// let listing_options = ListingOptions::new(Arc::new(
220-
/// ParquetFormat::default()
221-
/// ))
222-
/// .with_collect_stat(true);
215+
/// let listing_options =
216+
/// ListingOptions::new(Arc::new(ParquetFormat::default())).with_collect_stat(true);
223217
///
224218
/// assert_eq!(listing_options.collect_stat, true);
225219
/// ```
@@ -235,10 +229,8 @@ impl ListingOptions {
235229
/// # use datafusion_catalog_listing::ListingOptions;
236230
/// # use datafusion_datasource_parquet::file_format::ParquetFormat;
237231
///
238-
/// let listing_options = ListingOptions::new(Arc::new(
239-
/// ParquetFormat::default()
240-
/// ))
241-
/// .with_target_partitions(8);
232+
/// let listing_options =
233+
/// ListingOptions::new(Arc::new(ParquetFormat::default())).with_target_partitions(8);
242234
///
243235
/// assert_eq!(listing_options.target_partitions, 8);
244236
/// ```
@@ -255,15 +247,11 @@ impl ListingOptions {
255247
/// # use datafusion_catalog_listing::ListingOptions;
256248
/// # use datafusion_datasource_parquet::file_format::ParquetFormat;
257249
///
258-
/// // Tell datafusion that the files are sorted by column "a"
259-
/// let file_sort_order = vec![vec![
260-
/// col("a").sort(true, true)
261-
/// ]];
250+
/// // Tell datafusion that the files are sorted by column "a"
251+
/// let file_sort_order = vec![vec![col("a").sort(true, true)]];
262252
///
263-
/// let listing_options = ListingOptions::new(Arc::new(
264-
/// ParquetFormat::default()
265-
/// ))
266-
/// .with_file_sort_order(file_sort_order.clone());
253+
/// let listing_options = ListingOptions::new(Arc::new(ParquetFormat::default()))
254+
/// .with_file_sort_order(file_sort_order.clone());
267255
///
268256
/// assert_eq!(listing_options.file_sort_order, file_sort_order);
269257
/// ```

0 commit comments

Comments
 (0)