| 232 | } |
| 233 | |
| 234 | async fn scan( |
| 235 | &self, |
| 236 | _state: &dyn Session, |
| 237 | projection: Option<&Vec<usize>>, |
| 238 | _filters: &[Expr], |
| 239 | _limit: Option<usize>, |
| 240 | ) -> Result<Arc<dyn ExecutionPlan>> { |
| 241 | // Note that `scan` is called once the plan begin execution, and thus is |
| 242 | // async. When interacting with remote data sources, this is the place |
| 243 | // to begin establishing the remote connections and interacting with the |
| 244 | // remote storage system. |
| 245 | // |
| 246 | // As this example is just modeling the catalog API interface, we buffer |
| 247 | // the results locally in memory for simplicity. |
| 248 | let batches = self |
| 249 | .remote_catalog_interface |
| 250 | .read_data(&self.name) |
| 251 | .await? |
| 252 | .try_collect() |
| 253 | .await?; |
| 254 | let exec = MemorySourceConfig::try_new_exec( |
| 255 | &[batches], |
| 256 | self.schema.clone(), |
| 257 | projection.cloned(), |
| 258 | )?; |
| 259 | Ok(exec) |
| 260 | } |
| 261 | } |