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/29 19:35:40 UTC

[GitHub] [arrow-datafusion] andygrove commented on a diff in pull request #2642: Implement DESCRIBE
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: github-unsubscribe@arrow.apache.org

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