MCPcopy Create free account
hub / github.com/apache/paimon-rust / scan

Method scan

crates/integrations/datafusion/src/system_tables/table_indexes.rs:105–190  ·  view source on GitHub ↗
(
        &self,
        _state: &dyn Session,
        projection: Option<&Vec<usize>>,
        _filters: &[Expr],
        _limit: Option<usize>,
    )

Source from the content-addressed store, hash-verified

103 }
104
105 async fn scan(
106 &self,
107 _state: &dyn Session,
108 projection: Option<&Vec<usize>>,
109 _filters: &[Expr],
110 _limit: Option<usize>,
111 ) -> DFResult<Arc<dyn ExecutionPlan>> {
112 let table = self.table.clone();
113 let entries =
114 crate::runtime::await_with_runtime(async move { collect_index_entries(&table).await })
115 .await
116 .map_err(to_datafusion_error)?;
117
118 let partition_fields = self.table.schema().partition_fields();
119 let fields = self.table.schema().fields();
120 let n = entries.len();
121 let mut partitions: Vec<Option<String>> = Vec::with_capacity(n);
122 let mut buckets = Vec::with_capacity(n);
123 let mut index_types = Vec::with_capacity(n);
124 let mut file_names = Vec::with_capacity(n);
125 let mut file_sizes = Vec::with_capacity(n);
126 let mut row_counts = Vec::with_capacity(n);
127 let mut dv_ranges = dv_ranges_builder();
128 let mut row_range_starts: Vec<Option<i64>> = Vec::with_capacity(n);
129 let mut row_range_ends: Vec<Option<i64>> = Vec::with_capacity(n);
130 let mut index_field_ids: Vec<Option<i32>> = Vec::with_capacity(n);
131 let mut index_field_names: Vec<Option<String>> = Vec::with_capacity(n);
132
133 for entry in &entries {
134 let index_file = &entry.index_file;
135 partitions.push(Some(format_partition(&entry.partition, &partition_fields)?));
136 buckets.push(entry.bucket);
137 index_types.push(index_file.index_type.as_str());
138 file_names.push(index_file.file_name.as_str());
139 file_sizes.push(i64::from(index_file.file_size));
140 row_counts.push(i64::from(index_file.row_count));
141 append_dv_ranges(
142 &mut dv_ranges,
143 index_file
144 .deletion_vectors_ranges
145 .as_ref()
146 .map(|ranges| ranges.iter()),
147 );
148
149 if let Some(global_meta) = &index_file.global_index_meta {
150 row_range_starts.push(Some(global_meta.row_range_start));
151 row_range_ends.push(Some(global_meta.row_range_end));
152 index_field_ids.push(Some(global_meta.index_field_id));
153 index_field_names.push(
154 fields
155 .iter()
156 .find(|field| field.id() == global_meta.index_field_id)
157 .map(|field| field.name().to_string()),
158 );
159 } else {
160 row_range_starts.push(None);
161 row_range_ends.push(None);
162 index_field_ids.push(None);

Callers

nothing calls this directly

Calls 13

await_with_runtimeFunction · 0.85
collect_index_entriesFunction · 0.85
dv_ranges_builderFunction · 0.85
append_dv_rangesFunction · 0.85
table_indexes_schemaFunction · 0.85
partition_fieldsMethod · 0.80
format_partitionFunction · 0.70
schemaMethod · 0.45
fieldsMethod · 0.45
lenMethod · 0.45
iterMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected