Return a newline delimited stream from the specified file on Stream, decompressing if necessary Each returned `Bytes` has a whole number of newline delimited rows
(
&self,
store: &Arc<dyn ObjectStore>,
object: &ObjectMeta,
)
| 141 | /// Stream, decompressing if necessary |
| 142 | /// Each returned `Bytes` has a whole number of newline delimited rows |
| 143 | async fn read_to_delimited_chunks<'a>( |
| 144 | &self, |
| 145 | store: &Arc<dyn ObjectStore>, |
| 146 | object: &ObjectMeta, |
| 147 | ) -> BoxStream<'a, Result<Bytes>> { |
| 148 | // stream to only read as many rows as needed into memory |
| 149 | let stream = store |
| 150 | .get(&object.location) |
| 151 | .await |
| 152 | .map_err(|e| DataFusionError::ObjectStore(Box::new(e))); |
| 153 | let stream = match stream { |
| 154 | Ok(stream) => self |
| 155 | .read_to_delimited_chunks_from_stream( |
| 156 | stream |
| 157 | .into_stream() |
| 158 | .map_err(|e| DataFusionError::ObjectStore(Box::new(e))) |
| 159 | .boxed(), |
| 160 | ) |
| 161 | .await |
| 162 | .map_err(DataFusionError::from) |
| 163 | .left_stream(), |
| 164 | Err(e) => { |
| 165 | futures::stream::once(futures::future::ready(Err(e))).right_stream() |
| 166 | } |
| 167 | }; |
| 168 | stream.boxed() |
| 169 | } |
| 170 | |
| 171 | /// Convert a stream of bytes into a stream of of [`Bytes`] containing newline |
| 172 | /// delimited CSV records, while accounting for `\` and `"`. |
no test coverage detected