beliefer commented on a change in pull request #32442:
URL: https://github.com/apache/spark/pull/32442#discussion_r629173670



##########
File path: sql/core/src/test/resources/sql-tests/results/cte-ddl.sql.out
##########
@@ -0,0 +1,1152 @@
+-- Automatically generated by SQLQueryTestSuite
+-- Number of queries: 114
+
+
+-- !query
+CREATE NAMESPACE IF NOT EXISTS query_ddl_namespace
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+USE NAMESPACE query_ddl_namespace
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE TABLE test_show_tables(a INT, b STRING, c INT) using parquet
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE TABLE test_show_table_properties (a INT, b STRING, c INT) USING parquet 
TBLPROPERTIES('p1'='v1', 'p2'='v2')
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE TABLE test_show_partitions(a String, b Int, c String, d String) USING 
parquet PARTITIONED BY (c, d)
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+ALTER TABLE test_show_partitions ADD PARTITION (c='Us', d=1)
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+ALTER TABLE test_show_partitions ADD PARTITION (c='Us', d=2)
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+ALTER TABLE test_show_partitions ADD PARTITION (c='Cn', d=1)
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE VIEW view_1 AS SELECT * FROM test_show_tables
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE VIEW view_2 AS SELECT * FROM test_show_tables WHERE c=1
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE TEMPORARY VIEW test_show_views(e int) USING parquet
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE GLOBAL TEMP VIEW test_global_show_views AS SELECT 1 as col1
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SHOW NAMESPACES
+-- !query schema
+struct<namespace:string>
+-- !query output
+default
+query_ddl_namespace
+
+
+-- !query
+WITH s AS (SHOW NAMESPACES) SELECT * FROM s
+-- !query schema
+struct<namespace:string>
+-- !query output
+default
+query_ddl_namespace
+
+
+-- !query
+WITH s AS (SHOW NAMESPACES) SELECT namespace FROM s
+-- !query schema
+struct<namespace:string>
+-- !query output
+default
+query_ddl_namespace
+
+
+-- !query
+WITH s AS (SHOW NAMESPACES) SELECT * FROM s WHERE namespace = 
'query_ddl_namespace'
+-- !query schema
+struct<namespace:string>
+-- !query output
+query_ddl_namespace
+
+
+-- !query
+WITH s AS (SHOW NAMESPACES) SELECT namespace FROM s WHERE namespace = 
'query_ddl_namespace'
+-- !query schema
+struct<namespace:string>
+-- !query output
+query_ddl_namespace
+
+
+-- !query
+WITH s(n) AS (SHOW NAMESPACES) SELECT * FROM s
+-- !query schema
+struct<n:string>
+-- !query output
+default
+query_ddl_namespace
+
+
+-- !query
+WITH s(n) AS (SHOW NAMESPACES) SELECT n FROM s
+-- !query schema
+struct<n:string>
+-- !query output
+default
+query_ddl_namespace
+
+
+-- !query
+WITH s(n) AS (SHOW NAMESPACES) SELECT * FROM s WHERE n = 'query_ddl_namespace'
+-- !query schema
+struct<n:string>
+-- !query output
+query_ddl_namespace
+
+
+-- !query
+WITH s(n) AS (SHOW NAMESPACES) SELECT n FROM s WHERE n = 'query_ddl_namespace'
+-- !query schema
+struct<n:string>
+-- !query output
+query_ddl_namespace
+
+
+-- !query
+WITH s AS (SHOW NAMESPACES) SELECT namespace FROM s ORDER BY namespace
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.AnalysisException
+Information query does not support sorting in v2 catalog.
+
+
+-- !query
+WITH s AS (SHOW NAMESPACES) SELECT namespace FROM s GROUP BY namespace
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.AnalysisException
+Information query does not support aggregation in v2 catalog.
+
+
+-- !query
+WITH s(n) AS (SHOW NAMESPACES) SELECT n FROM s ORDER BY n
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.AnalysisException
+Information query does not support sorting in v2 catalog.
+
+
+-- !query
+WITH s(n) AS (SHOW NAMESPACES) SELECT n FROM s GROUP BY n
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.AnalysisException
+Information query does not support aggregation in v2 catalog.
+
+
+-- !query
+SHOW TABLES
+-- !query schema
+struct<namespace:string,tableName:string,isTemporary:boolean>
+-- !query output
+test_show_partitions
+test_show_table_properties
+test_show_tables
+test_show_views
+view_1
+view_2
+
+
+-- !query
+WITH s AS (SHOW TABLES) SELECT * FROM s
+-- !query schema
+struct<namespace:string,tableName:string,isTemporary:boolean>
+-- !query output
+test_show_partitions
+test_show_table_properties
+test_show_tables
+test_show_views
+view_1
+view_2
+
+
+-- !query
+WITH s AS (SHOW TABLES) SELECT tableName FROM s
+-- !query schema
+struct<tableName:string>
+-- !query output
+test_show_partitions
+test_show_table_properties
+test_show_tables
+test_show_views
+view_1
+view_2
+
+
+-- !query
+WITH s AS (SHOW TABLES) SELECT * FROM s WHERE tableName = 'test_show_tables'
+-- !query schema
+struct<namespace:string,tableName:string,isTemporary:boolean>
+-- !query output
+query_ddl_namespace    test_show_tables        false
+
+
+-- !query
+WITH s AS (SHOW TABLES) SELECT tableName FROM s WHERE tableName = 
'test_show_tables'
+-- !query schema
+struct<tableName:string>
+-- !query output
+test_show_tables
+
+
+-- !query
+WITH s(ns, tn, t) AS (SHOW TABLES) SELECT * FROM s
+-- !query schema
+struct<ns:string,tn:string,t:boolean>
+-- !query output
+       test_show_views true
+query_ddl_namespace    test_show_partitions    false
+query_ddl_namespace    test_show_table_properties      false
+query_ddl_namespace    test_show_tables        false
+query_ddl_namespace    view_1  false
+query_ddl_namespace    view_2  false
+
+
+-- !query
+WITH s(ns, tn, t) AS (SHOW TABLES) SELECT tn FROM s
+-- !query schema
+struct<tn:string>
+-- !query output
+test_show_partitions
+test_show_table_properties
+test_show_tables
+test_show_views
+view_1
+view_2
+
+
+-- !query
+WITH s(ns, tn, t) AS (SHOW TABLES) SELECT * FROM s WHERE tn = 
'test_show_tables'
+-- !query schema
+struct<ns:string,tn:string,t:boolean>
+-- !query output
+query_ddl_namespace    test_show_tables        false
+
+
+-- !query
+WITH s(ns, tn, t) AS (SHOW TABLES) SELECT tn FROM s WHERE tn = 
'test_show_tables'
+-- !query schema
+struct<tn:string>
+-- !query output
+test_show_tables
+
+
+-- !query
+WITH s AS (SHOW TABLES) SELECT tableName FROM s ORDER BY namespace
+-- !query schema
+struct<tableName:string>
+-- !query output
+test_show_views
+test_show_table_properties
+test_show_tables
+view_1
+view_2
+
+
+-- !query
+WITH s AS (SHOW TABLES) SELECT COUNT(tableName) FROM s GROUP BY namespace
+-- !query schema
+struct<count(tableName):bigint>
+-- !query output
+1
+5
+
+
+-- !query
+WITH s(ns, tn, t) AS (SHOW TABLES) SELECT tn FROM s ORDER BY ns
+-- !query schema
+struct<tn:string>
+-- !query output
+test_show_views
+test_show_partitions
+test_show_table_properties
+test_show_tables
+view_1
+view_2
+
+
+-- !query
+WITH s(ns, tn, t) AS (SHOW TABLES) SELECT COUNT(tn) FROM s GROUP BY ns
+-- !query schema
+struct<count(tn):bigint>
+-- !query output
+1
+5
+
+
+-- !query
+SHOW TABLE EXTENDED LIKE 'test_show_table*'
+-- !query schema
+struct<namespace:string,tableName:string,isTemporary:boolean,information:string>
+-- !query output
+query_ddl_namespace    test_show_table_properties      false   Database: 
query_ddl_namespace
+Table: test_show_table_properties
+Created Time [not included in comparison]
+Last Access [not included in comparison]
+Created By [not included in comparison]
+Type: MANAGED
+Provider: parquet
+Table Properties: [p1=v1, p2=v2]
+Location [not included in 
comparison]/{warehouse_dir}/query_ddl_namespace.db/test_show_table_properties
+Schema: root
+ |-- a: integer (nullable = true)
+ |-- b: string (nullable = true)
+ |-- c: integer (nullable = true)
+
+
+query_ddl_namespace    test_show_tables        false   Database: 
query_ddl_namespace
+Table: test_show_tables
+Created Time [not included in comparison]
+Last Access [not included in comparison]
+Created By [not included in comparison]
+Type: MANAGED
+Provider: parquet
+Location [not included in 
comparison]/{warehouse_dir}/query_ddl_namespace.db/test_show_tables
+Schema: root
+ |-- a: integer (nullable = true)
+ |-- b: string (nullable = true)
+ |-- c: integer (nullable = true)
+
+
+-- !query
+WITH s AS (SHOW TABLE EXTENDED LIKE 'test_show_table*') SELECT * FROM s
+-- !query schema
+struct<namespace:string,tableName:string,isTemporary:boolean,information:string>
+-- !query output
+query_ddl_namespace    test_show_table_properties      false   Database: 
query_ddl_namespace
+Table: test_show_table_properties
+Created Time [not included in comparison]
+Last Access [not included in comparison]
+Created By [not included in comparison]
+Type: MANAGED
+Provider: parquet
+Table Properties: [p1=v1, p2=v2]
+Location [not included in 
comparison]/{warehouse_dir}/query_ddl_namespace.db/test_show_table_properties
+Schema: root
+ |-- a: integer (nullable = true)
+ |-- b: string (nullable = true)
+ |-- c: integer (nullable = true)
+
+
+query_ddl_namespace    test_show_tables        false   Database: 
query_ddl_namespace
+Table: test_show_tables
+Created Time [not included in comparison]
+Last Access [not included in comparison]
+Created By [not included in comparison]
+Type: MANAGED
+Provider: parquet
+Location [not included in 
comparison]/{warehouse_dir}/query_ddl_namespace.db/test_show_tables
+Schema: root
+ |-- a: integer (nullable = true)
+ |-- b: string (nullable = true)
+ |-- c: integer (nullable = true)
+
+
+-- !query
+WITH s AS (SHOW TABLE EXTENDED LIKE 'test_show_table*') SELECT isTemporary 
FROM s
+-- !query schema
+struct<isTemporary:boolean>
+-- !query output
+false
+false
+
+
+-- !query
+WITH s AS (SHOW TABLE EXTENDED LIKE 'test_show_table*') SELECT * FROM s WHERE 
tableName = 'test_show_tables'
+-- !query schema
+struct<namespace:string,tableName:string,isTemporary:boolean,information:string>
+-- !query output
+query_ddl_namespace    test_show_tables        false   Database: 
query_ddl_namespace
+Table: test_show_tables
+Created Time [not included in comparison]
+Last Access [not included in comparison]
+Created By [not included in comparison]
+Type: MANAGED
+Provider: parquet
+Location [not included in 
comparison]/{warehouse_dir}/query_ddl_namespace.db/test_show_tables
+Schema: root
+ |-- a: integer (nullable = true)
+ |-- b: string (nullable = true)
+ |-- c: integer (nullable = true)
+
+
+-- !query
+WITH s AS (SHOW TABLE EXTENDED LIKE 'test_show_table*') SELECT isTemporary 
FROM s WHERE tableName = 'test_show_tables'
+-- !query schema
+struct<isTemporary:boolean>
+-- !query output
+false
+
+
+-- !query
+WITH s(ns, tn, t, info) AS (SHOW TABLE EXTENDED LIKE 'test_show_table*') 
SELECT * FROM s
+-- !query schema
+struct<ns:string,tn:string,t:boolean,info:string>
+-- !query output
+query_ddl_namespace    test_show_table_properties      false   Database: 
query_ddl_namespace
+Table: test_show_table_properties
+Created Time [not included in comparison]
+Last Access [not included in comparison]
+Created By [not included in comparison]
+Type: MANAGED
+Provider: parquet
+Table Properties: [p1=v1, p2=v2]
+Location [not included in 
comparison]/{warehouse_dir}/query_ddl_namespace.db/test_show_table_properties
+Schema: root
+ |-- a: integer (nullable = true)
+ |-- b: string (nullable = true)
+ |-- c: integer (nullable = true)
+
+
+query_ddl_namespace    test_show_tables        false   Database: 
query_ddl_namespace
+Table: test_show_tables
+Created Time [not included in comparison]
+Last Access [not included in comparison]
+Created By [not included in comparison]
+Type: MANAGED
+Provider: parquet
+Location [not included in 
comparison]/{warehouse_dir}/query_ddl_namespace.db/test_show_tables
+Schema: root
+ |-- a: integer (nullable = true)
+ |-- b: string (nullable = true)
+ |-- c: integer (nullable = true)
+
+
+-- !query
+WITH s(ns, tn, t, info) AS (SHOW TABLE EXTENDED LIKE 'test_show_table*') 
SELECT t FROM s
+-- !query schema
+struct<t:boolean>
+-- !query output
+false
+false
+
+
+-- !query
+WITH s(ns, tn, t, info) AS (SHOW TABLE EXTENDED LIKE 'test_show_table*') 
SELECT * FROM s WHERE tn = 'test_show_tables'
+-- !query schema
+struct<ns:string,tn:string,t:boolean,info:string>
+-- !query output
+query_ddl_namespace    test_show_tables        false   Database: 
query_ddl_namespace
+Table: test_show_tables
+Created Time [not included in comparison]
+Last Access [not included in comparison]
+Created By [not included in comparison]
+Type: MANAGED
+Provider: parquet
+Location [not included in 
comparison]/{warehouse_dir}/query_ddl_namespace.db/test_show_tables
+Schema: root
+ |-- a: integer (nullable = true)
+ |-- b: string (nullable = true)
+ |-- c: integer (nullable = true)
+
+
+-- !query
+WITH s(ns, tn, t, info) AS (SHOW TABLE EXTENDED LIKE 'test_show_table*') 
SELECT t FROM s WHERE tn = 'test_show_tables'
+-- !query schema
+struct<t:boolean>
+-- !query output
+false
+
+
+-- !query
+WITH s AS (SHOW TABLE EXTENDED LIKE 'test_show_table*') SELECT * FROM s ORDER 
BY tableName
+-- !query schema
+struct<>
+-- !query output
+java.lang.ClassCastException
+org.apache.spark.sql.catalyst.expressions.GenericInternalRow cannot be cast to 
org.apache.spark.sql.catalyst.expressions.UnsafeRow

Review comment:
       I don't know the reason yet. It seems we should fix this issue in 
another PR?
   cc @cloud-fan @wangyum @maropu @viirya 




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to