[GitHub] [arrow-datafusion] andygrove commented on a diff in pull request #2642: Implement DESCRIBE

Sun, 29 May 2022 12:35:48 -0700


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


##########
datafusion/sql/src/planner.rs:
##########
@@ -353,6 +354,24 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
         }
     }
 
+    pub fn decrible_table_to_plan(
+        &self,
+        statement: DescribeTable,
+    ) -> Result<LogicalPlan> {
+        if self.has_table("information_schema", "tables") {
+            let table_name = statement.table_name;
+            let sql = format!("SELECT column_name, data_type, is_nullable \
+                                FROM information_schema.columns WHERE 
table_name = '{table_name}';");
+            let mut rewrite = DFParser::parse_sql(&sql[..])?;
+            self.statement_to_plan(rewrite.pop_front().unwrap())
+        } else {
+            Err(DataFusionError::Plan(
+                "SHOW TABLES is not supported unless information_schema is 
enabled"

Review Comment:
   ```suggestion
                   "DESCRIBE TABLE is not supported unless information_schema 
is enabled"
   ```



##########
datafusion/sql/src/planner.rs:
##########
@@ -353,6 +354,24 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
         }
     }
 
+    pub fn decrible_table_to_plan(

Review Comment:
   ```suggestion
       pub fn decribe_table_to_plan(
   ```



-- 
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: [email protected]

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

Reply via email to