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:47:36 UTC

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

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


##########
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 with name '{}' not found",
+                name.table()
+            ))),
+        }

Review Comment:
   Yes, this is a much better suggestion.



-- 
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