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

Method open

datafusion/datasource-arrow/src/source.rs:73–108  ·  view source on GitHub ↗
(&self, partitioned_file: PartitionedFile)

Source from the content-addressed store, hash-verified

71
72impl FileOpener for ArrowStreamFileOpener {
73 fn open(&self, partitioned_file: PartitionedFile) -> Result<FileOpenFuture> {
74 if partitioned_file.range.is_some() {
75 return Err(exec_datafusion_err!(
76 "ArrowStreamFileOpener does not support range-based reading"
77 ));
78 }
79 let object_store = Arc::clone(&self.object_store);
80 let projection = self.projection.clone();
81
82 Ok(Box::pin(async move {
83 let r = object_store
84 .get(&partitioned_file.object_meta.location)
85 .await?;
86
87 let stream = match r.payload {
88 #[cfg(not(target_arch = "wasm32"))]
89 GetResultPayload::File(file, _) => futures::stream::iter(
90 StreamReader::try_new(file.try_clone()?, projection.clone())?,
91 )
92 .map(|r| r.map_err(Into::into))
93 .boxed(),
94 GetResultPayload::Stream(_) => {
95 let bytes = r.bytes().await?;
96 let cursor = Cursor::new(bytes);
97 futures::stream::iter(StreamReader::try_new(
98 cursor,
99 projection.clone(),
100 )?)
101 .map(|r| r.map_err(Into::into))
102 .boxed()
103 }
104 };
105
106 Ok(stream)
107 }))
108 }
109}
110
111/// `FileOpener` for Arrow IPC file format. Supports range-based parallel reading.

Calls 15

newFunction · 0.85
flattenMethod · 0.80
cloneMethod · 0.45
getMethod · 0.45
mapMethod · 0.45
get_optsMethod · 0.45
schemaMethod · 0.45
intoMethod · 0.45
versionMethod · 0.45
with_projectionMethod · 0.45
iterMethod · 0.45
offsetMethod · 0.45