You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/05/03 21:28:55 UTC

[GitHub] [arrow-datafusion] andygrove commented on a diff in pull request #2438: Table provider error propagation

andygrove commented on code in PR #2438:
URL: https://github.com/apache/arrow-datafusion/pull/2438#discussion_r864275655


##########
datafusion/core/src/execution/context.rs:
##########
@@ -1364,10 +1364,16 @@ impl SessionState {
 }
 
 impl ContextProvider for SessionState {
-    fn get_table_provider(&self, name: TableReference) -> Option<Arc<dyn TableProvider>> {
+    fn get_table_provider(&self, name: TableReference) -> Result<Arc<dyn TableProvider>> {
         let resolved_ref = self.resolve_table_ref(name);
-        let schema = self.schema_for_ref(resolved_ref).ok()?;
-        schema.table(resolved_ref.table)
+        let schema = self.schema_for_ref(resolved_ref).unwrap();
+        match schema.table(resolved_ref.table) {
+            Some(e) => Ok(e),
+            None => Err(DataFusionError::Plan(format!(
+                "Table or CTE with name '{}' not found",

Review Comment:
   We shouldn't be attempting to resolve CTEs via `get_table_provider`
   
   ```suggestion
                   "Table with name '{}' not found",
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org