alamb commented on a change in pull request #9866:
URL: https://github.com/apache/arrow/pull/9866#discussion_r605970581



##########
File path: rust/datafusion/src/sql/planner.rs
##########
@@ -1305,6 +1304,74 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
             )))
         }
     }
+
+    fn show_columns_to_plan(
+        &self,
+        extended: bool,
+        full: bool,
+        table_name: &ObjectName,
+        filter: Option<&ShowStatementFilter>,
+    ) -> Result<LogicalPlan> {
+        if filter.is_some() {
+            return Err(DataFusionError::Plan(
+                "SHOW COLUMNS with WHERE or LIKE is not supported".to_string(),
+            ));
+        }
+
+        if !self.has_table("information_schema", "columns") {
+            return Err(DataFusionError::Plan(
+                "SHOW COLUMNS is not supported unless information_schema is 
enabled"
+                    .to_string(),
+            ));
+        }
+
+        if self
+            .schema_provider
+            .get_table_provider(table_name.try_into()?)
+            .is_none()
+        {
+            return Err(DataFusionError::Plan(format!(
+                "Unknown relation for SHOW COLUMNS: {}",
+                table_name
+            )));
+        }
+
+        // Figure out the where clause
+        let columns = vec!["table_name", "table_schema", 
"table_catalog"].into_iter();
+        let where_clause = table_name
+            .0
+            .iter()
+            .rev()

Review comment:
       I was thinking because the identifier may not have a `table_catalog` or 
`table_schema` 
   
   So you have to handle the case of 
   
   `table_name` (position 0)
   `table_name` (position 1), `schema_name` (postition 0)
   `table_name` (postition 2), `schema_name` (postition 1), `catalog_name` 
(position 0), 
   
   So this formulation was what I could come up with that would match them up 
to the information_schema column names
   
   I am open to other ways of doing it as well if you have suggestions




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to