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

Method build_decoder

arrow-csv/src/reader/mod.rs:1246–1271  ·  view source on GitHub ↗

Builds a decoder that can be used to decode CSV from an arbitrary byte stream

(self)

Source from the content-addressed store, hash-verified

1244
1245 /// Builds a decoder that can be used to decode CSV from an arbitrary byte stream
1246 pub fn build_decoder(self) -> Decoder {
1247 let delimiter = self.format.build_parser();
1248 let record_decoder = RecordDecoder::new(
1249 delimiter,
1250 self.schema.fields().len(),
1251 self.format.truncated_rows,
1252 );
1253
1254 let header = self.format.header as usize;
1255
1256 let (start, end) = match self.bounds {
1257 Some((start, end)) => (start + header, end + header),
1258 None => (header, usize::MAX),
1259 };
1260
1261 Decoder {
1262 schema: self.schema,
1263 to_skip: start,
1264 record_decoder,
1265 line_number: start,
1266 end,
1267 projection: self.projection,
1268 batch_size: self.batch_size,
1269 null_regex: self.format.null_regex,
1270 }
1271 }
1272}
1273
1274#[cfg(test)]

Calls 3

build_parserMethod · 0.80
lenMethod · 0.45
fieldsMethod · 0.45