jackwener commented on code in PR #4905:
URL: https://github.com/apache/arrow-datafusion/pull/4905#discussion_r1070591656


##########
datafusion/core/tests/sqllogictests/test_files/information_schema.slt:
##########
@@ -152,3 +155,213 @@ query R
 SHOW TIMEZONE
 ----
 datafusion.execution.time_zone +00:00
+
+
+# information_schema_describe_table
+
+## some_table
+statement ok
+CREATE OR REPLACE TABLE some_table AS VALUES (1,2),(3,4);
+
+query R
+DESCRIBE some_table
+----
+column1 Int64 YES
+column2 Int64 YES
+
+statement ok
+DROP TABLE public.some_table;
+
+## public.some_table
+
+statement ok
+CREATE OR REPLACE TABLE public.some_table AS VALUES (1,2),(3,4);
+
+query R
+DESCRIBE public.some_table
+----
+column1 Int64 YES
+column2 Int64 YES
+
+statement ok
+DROP TABLE public.some_table;
+
+## datafusion.public.some_table
+
+statement ok
+CREATE OR REPLACE TABLE datafusion.public.some_table AS VALUES (1,2),(3,4);
+
+query R
+DESCRIBE datafusion.public.some_table
+----
+column1 Int64 YES
+column2 Int64 YES
+
+statement ok
+DROP TABLE datafusion.public.some_table;
+
+# information_schema_describe_table_not_exists
+
+statement error Error during planning: table 'datafusion.public.table' not 
found
+describe table;
+
+
+# information_schema_show_tables
+query CCCC
+SHOW TABLES
+----
+datafusion information_schema tables VIEW
+datafusion information_schema views VIEW
+datafusion information_schema columns VIEW
+datafusion information_schema df_settings VIEW
+
+
+# information_schema_show_tables_no_information_schema
+
+statement ok
+set datafusion.catalog.information_schema = false;
+
+statement error Error during planning: SHOW TABLES is not supported unless 
information_schema is enabled
+SHOW TABLES
+
+statement ok
+set datafusion.catalog.information_schema = true;
+
+
+# information_schema_show_columns
+statement ok
+CREATE TABLE t AS SELECT 1::int as i;
+
+statement error Error during planning: SHOW COLUMNS with WHERE or LIKE is not 
supported
+SHOW COLUMNS FROM t LIKE 'f';
+
+statement error Error during planning: SHOW COLUMNS with WHERE or LIKE is not 
supported
+SHOW COLUMNS FROM t WHERE column_name = 'bar';
+
+query CCCCCC
+SHOW COLUMNS FROM t;
+----
+datafusion public t i Int32 NO
+
+# This isn't ideal but it is consistent behavior for `SELECT * from "T"`
+statement error Error during planning: table 'datafusion.public.T' not found
+SHOW columns from "T"
+
+# information_schema_show_columns_full_extended
+query CCCCCC
+SHOW FULL COLUMNS FROM t;
+----
+datafusion public t i 0 NULL NO Int32 NULL NULL 32 2 NULL NULL NULL
+
+# expect same as above
+query CCCCCC
+SHOW EXTENDED COLUMNS FROM t;
+----
+datafusion public t i 0 NULL NO Int32 NULL NULL 32 2 NULL NULL NULL
+
+# information_schema_show_columns_no_information_schema
+
+statement ok
+set datafusion.catalog.information_schema = false;
+
+statement error Error during planning: SHOW COLUMNS is not supported unless 
information_schema is enabled
+SHOW COLUMNS FROM t
+
+statement ok
+set datafusion.catalog.information_schema = true;
+
+
+# information_schema_show_columns_names()
+query CCCCCC
+SHOW columns from public.t
+----
+datafusion public t i Int32 NO
+
+query CCCCCC
+SHOW columns from datafusion.public.t
+----
+datafusion public t i Int32 NO
+
+statement error Error during planning: table 'datafusion.public.t2' not found
+SHOW columns from t2
+
+statement error Error during planning: table 'datafusion.public.t2' not found
+SHOW columns from datafusion.public.t2
+
+
+# show_non_existing_variable
+# FIXME
+# currently we cannot know whether a variable exists, this will output 0 row 
instead

Review Comment:
   Keep `FIXME`👍



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