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

Method build

crates/integrations/datafusion/src/table/mod.rs:105–143  ·  view source on GitHub ↗

Build a [`PaimonTableScan`] from the configured parameters.

(self)

Source from the content-addressed store, hash-verified

103impl PaimonScanBuilder<'_> {
104 /// Build a [`PaimonTableScan`] from the configured parameters.
105 pub(crate) fn build(self) -> DFResult<Arc<dyn ExecutionPlan>> {
106 let (projected_schema, projected_columns) = if let Some(indices) = self.projection {
107 let fields: Vec<Field> = indices
108 .iter()
109 .map(|&i| self.schema.field(i).clone())
110 .collect();
111 let column_names: Vec<String> = fields.iter().map(|f| f.name().clone()).collect();
112 (Arc::new(Schema::new(fields)), Some(column_names))
113 } else {
114 let column_names: Vec<String> = self
115 .schema
116 .fields()
117 .iter()
118 .map(|f| f.name().clone())
119 .collect();
120 (self.schema.clone(), Some(column_names))
121 };
122
123 let splits = self.plan.splits().to_vec();
124 let planned_partitions: Vec<Arc<[_]>> = if splits.is_empty() {
125 vec![Arc::from(Vec::new())]
126 } else {
127 let num_partitions = splits.len().min(self.target_partitions.max(1));
128 bucket_round_robin(splits, num_partitions)
129 .into_iter()
130 .map(Arc::from)
131 .collect()
132 };
133
134 Ok(Arc::new(PaimonTableScan::new(
135 projected_schema,
136 self.table.clone(),
137 projected_columns,
138 self.pushed_predicate,
139 planned_partitions,
140 self.limit,
141 self.filter_exact,
142 )))
143 }
144}
145
146#[async_trait]

Callers 15

memory_file_ioFunction · 0.45
unpartitioned_schemaFunction · 0.45
fixed_bucket_schemaFunction · 0.45
partitioned_schemaFunction · 0.45
simple_log_schemaFunction · 0.45
test_file_ioFunction · 0.45
test_snapshotFunction · 0.45
plan_relationMethod · 0.45
scanMethod · 0.45

Calls 8

bucket_round_robinFunction · 0.85
to_vecMethod · 0.80
splitsMethod · 0.80
iterMethod · 0.45
nameMethod · 0.45
fieldsMethod · 0.45
is_emptyMethod · 0.45
lenMethod · 0.45

Tested by 15

memory_file_ioFunction · 0.36
unpartitioned_schemaFunction · 0.36
fixed_bucket_schemaFunction · 0.36
partitioned_schemaFunction · 0.36
simple_log_schemaFunction · 0.36
test_file_ioFunction · 0.36
test_snapshotFunction · 0.36
test_tableFunction · 0.36