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

Method eq_properties

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

Computes the effective equivalence properties of this file scan, taking into account the file schema, any projections or filters applied by the file source, and the output ordering.

(&self)

Source from the content-addressed store, hash-verified

754 /// into account the file schema, any projections or filters applied by the
755 /// file source, and the output ordering.
756 fn eq_properties(&self) -> EquivalenceProperties {
757 let schema = self.file_source.table_schema().table_schema();
758 let mut eq_properties = EquivalenceProperties::new_with_orderings(
759 Arc::clone(schema),
760 self.validated_output_ordering(),
761 )
762 .with_constraints(self.constraints.clone());
763
764 if let Some(filter) = self.file_source.filter() {
765 // We need to remap column indexes to match the projected schema since that's what the equivalence properties deal with.
766 // Note that this will *ignore* any non-projected columns: these don't factor into ordering / equivalence.
767 match Self::add_filter_equivalence_info(&filter, &mut eq_properties, schema) {
768 Ok(()) => {}
769 Err(e) => {
770 warn!("Failed to add filter equivalence info: {e}");
771 #[cfg(debug_assertions)]
772 panic!("Failed to add filter equivalence info: {e}");
773 }
774 }
775 }
776
777 if let Some(projection) = self.file_source.projection() {
778 match (
779 projection.project_schema(schema),
780 projection.projection_mapping(schema),
781 ) {
782 (Ok(output_schema), Ok(mapping)) => {
783 eq_properties =
784 eq_properties.project(&mapping, Arc::new(output_schema));
785 }
786 (Err(e), _) | (_, Err(e)) => {
787 warn!("Failed to project equivalence properties: {e}");
788 #[cfg(debug_assertions)]
789 panic!("Failed to project equivalence properties: {e}");
790 }
791 }
792 }
793
794 eq_properties
795 }
796
797 fn scheduling_type(&self) -> SchedulingType {
798 SchedulingType::Cooperative

Calls 10

newFunction · 0.85
project_schemaMethod · 0.80
projection_mappingMethod · 0.80
table_schemaMethod · 0.45
with_constraintsMethod · 0.45
cloneMethod · 0.45
filterMethod · 0.45
projectionMethod · 0.45
projectMethod · 0.45