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

Method column_indices

datafusion/physical-expr/src/projection.rs:388–395  ·  view source on GitHub ↗

Extract the column indices used in this projection. For example, for a projection `SELECT a AS x, b + 1 AS y`, where `a` is at index 0 and `b` is at index 1, this function would return `[0, 1]`. Repeated indices are returned only once, and the order is ascending.

(&self)

Source from the content-addressed store, hash-verified

386 /// this function would return `[0, 1]`.
387 /// Repeated indices are returned only once, and the order is ascending.
388 pub fn column_indices(&self) -> Vec<usize> {
389 self.exprs
390 .iter()
391 .flat_map(|e| collect_columns(&e.expr).into_iter().map(|col| col.index()))
392 .sorted_unstable()
393 .dedup()
394 .collect_vec()
395 }
396
397 /// Extract the ordered column indices for a column-only projection.
398 ///

Calls 5

collect_columnsFunction · 0.85
iterMethod · 0.45
mapMethod · 0.45
into_iterMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected