MCPcopy Create free account
hub / github.com/apache/arrow-rs / build

Method build

parquet/src/record/reader.rs:64–93  ·  view source on GitHub ↗

Creates new root reader for provided schema and row group.

(
        &self,
        descr: SchemaDescPtr,
        row_group_reader: &dyn RowGroupReader,
    )

Source from the content-addressed store, hash-verified

62
63 /// Creates new root reader for provided schema and row group.
64 pub fn build(
65 &self,
66 descr: SchemaDescPtr,
67 row_group_reader: &dyn RowGroupReader,
68 ) -> Result<Reader> {
69 // Prepare lookup table of column path -> original column index
70 // This allows to prune columns and map schema leaf nodes to the column readers
71 let mut paths: HashMap<ColumnPath, usize> = HashMap::new();
72 let row_group_metadata = row_group_reader.metadata();
73
74 for col_index in 0..row_group_reader.num_columns() {
75 let col_meta = row_group_metadata.column(col_index);
76 let col_path = col_meta.column_path().clone();
77 paths.insert(col_path, col_index);
78 }
79
80 // Build child readers for the message type
81 let mut readers = Vec::new();
82 let mut path = Vec::new();
83
84 for field in descr.root_schema().get_fields() {
85 let reader =
86 self.reader_tree(field.clone(), &mut path, 0, 0, &paths, row_group_reader)?;
87 readers.push(reader);
88 }
89
90 // Return group reader for message type,
91 // it is always required with definition level 0
92 Ok(Reader::GroupReader(None, 0, readers))
93 }
94
95 /// Creates iterator of `Row`s directly from schema descriptor and row group.
96 pub fn as_iter(

Callers 4

as_iterMethod · 0.45
reader_treeMethod · 0.45
assert_err_on_overcountFunction · 0.45

Calls 10

column_pathMethod · 0.80
get_fieldsMethod · 0.80
root_schemaMethod · 0.80
reader_treeMethod · 0.80
metadataMethod · 0.45
num_columnsMethod · 0.45
columnMethod · 0.45
cloneMethod · 0.45
insertMethod · 0.45
pushMethod · 0.45

Tested by 1