MCPcopy Create free account
hub / github.com/apache/datafusion / build

Method build

datafusion/datasource/src/file_scan_config/mod.rs:512–552  ·  view source on GitHub ↗

Build the final [`FileScanConfig`] with all the configured settings. This method takes ownership of the builder and returns the constructed `FileScanConfig`. Any unset optional fields will use their default values. # Errors Returns an error if projection pushdown fails or if schema operations fail.

(self)

Source from the content-addressed store, hash-verified

510 /// # Errors
511 /// Returns an error if projection pushdown fails or if schema operations fail.
512 pub fn build(self) -> FileScanConfig {
513 let Self {
514 object_store_url,
515 file_source,
516 limit,
517 preserve_order,
518 constraints,
519 file_groups,
520 statistics,
521 output_ordering,
522 file_compression_type,
523 batch_size,
524 expr_adapter_factory: expr_adapter,
525 partitioned_by_file_group,
526 } = self;
527
528 let constraints = constraints.unwrap_or_default();
529 let statistics = statistics.unwrap_or_else(|| {
530 Statistics::new_unknown(file_source.table_schema().table_schema())
531 });
532 let file_compression_type =
533 file_compression_type.unwrap_or(FileCompressionType::UNCOMPRESSED);
534
535 // If there is an output ordering, we should preserve it.
536 let preserve_order = preserve_order || !output_ordering.is_empty();
537
538 FileScanConfig {
539 object_store_url,
540 file_source,
541 limit,
542 preserve_order,
543 constraints,
544 file_groups,
545 output_ordering,
546 file_compression_type,
547 batch_size,
548 expr_adapter_factory: expr_adapter,
549 statistics,
550 partitioned_by_file_group,
551 }
552 }
553}
554
555impl From<FileScanConfig> for FileScanConfigBuilder {

Calls 2

table_schemaMethod · 0.45
is_emptyMethod · 0.45