Skip to content

Commit

Permalink
add legacy test
Browse files Browse the repository at this point in the history
  • Loading branch information
yaooqinn committed Mar 11, 2021
1 parent 2546812 commit 423796f
Show file tree
Hide file tree
Showing 2 changed files with 288 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--SET spark.sql.legacy.keepCommandOutputSchema=true
--IMPORT show-tables.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,286 @@
-- Automatically generated by SQLQueryTestSuite
-- Number of queries: 27


-- !query
CREATE DATABASE showdb
-- !query schema
struct<>
-- !query output



-- !query
USE showdb
-- !query schema
struct<>
-- !query output



-- !query
CREATE TABLE show_t1(a String, b Int, c String, d String) USING parquet PARTITIONED BY (c, d)
-- !query schema
struct<>
-- !query output



-- !query
ALTER TABLE show_t1 ADD PARTITION (c='Us', d=1)
-- !query schema
struct<>
-- !query output



-- !query
CREATE TABLE show_t2(b String, d Int) USING parquet
-- !query schema
struct<>
-- !query output



-- !query
CREATE TEMPORARY VIEW show_t3(e int) USING parquet
-- !query schema
struct<>
-- !query output



-- !query
CREATE GLOBAL TEMP VIEW show_t4 AS SELECT 1 as col1
-- !query schema
struct<>
-- !query output



-- !query
SHOW TABLES
-- !query schema
struct<database:string,tableName:string,isTemporary:boolean>
-- !query output
show_t1
show_t2
show_t3


-- !query
SHOW TABLES IN showdb
-- !query schema
struct<database:string,tableName:string,isTemporary:boolean>
-- !query output
show_t1
show_t2
show_t3


-- !query
SHOW TABLES 'show_t*'
-- !query schema
struct<database:string,tableName:string,isTemporary:boolean>
-- !query output
show_t1
show_t2
show_t3


-- !query
SHOW TABLES LIKE 'show_t1*|show_t2*'
-- !query schema
struct<database:string,tableName:string,isTemporary:boolean>
-- !query output
show_t1
show_t2


-- !query
SHOW TABLES IN showdb 'show_t*'
-- !query schema
struct<database:string,tableName:string,isTemporary:boolean>
-- !query output
show_t1
show_t2
show_t3


-- !query
SHOW TABLES IN showdb LIKE 'show_t*'
-- !query schema
struct<database:string,tableName:string,isTemporary:boolean>
-- !query output
show_t1
show_t2
show_t3


-- !query
SHOW TABLE EXTENDED LIKE 'show_t*'
-- !query schema
struct<database:string,tableName:string,isTemporary:boolean,information:string>
-- !query output
show_t3 true Table: show_t3
Created Time [not included in comparison]
Last Access [not included in comparison]
Created By [not included in comparison]
Type: VIEW
Schema: root
|-- e: integer (nullable = true)


showdb show_t1 false Database: showdb
Table: show_t1
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}/showdb.db/show_t1
Partition Provider: Catalog
Partition Columns: [`c`, `d`]
Schema: root
|-- a: string (nullable = true)
|-- b: integer (nullable = true)
|-- c: string (nullable = true)
|-- d: string (nullable = true)


showdb show_t2 false Database: showdb
Table: show_t2
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}/showdb.db/show_t2
Schema: root
|-- b: string (nullable = true)
|-- d: integer (nullable = true)


-- !query
SHOW TABLE EXTENDED
-- !query schema
struct<>
-- !query output
org.apache.spark.sql.catalyst.parser.ParseException

mismatched input '<EOF>' expecting {'FROM', 'IN', 'LIKE'}(line 1, pos 19)

== SQL ==
SHOW TABLE EXTENDED
-------------------^^^


-- !query
SHOW TABLE EXTENDED LIKE 'show_t1' PARTITION(c='Us', d=1)
-- !query schema
struct<database:string,tableName:string,isTemporary:boolean,information:string>
-- !query output
showdb show_t1 false Partition Values: [c=Us, d=1]
Location [not included in comparison]/{warehouse_dir}/showdb.db/show_t1/c=Us/d=1
Created Time [not included in comparison]
Last Access [not included in comparison]


-- !query
SHOW TABLE EXTENDED PARTITION(c='Us', d=1)
-- !query schema
struct<>
-- !query output
org.apache.spark.sql.catalyst.parser.ParseException

mismatched input 'PARTITION' expecting {'FROM', 'IN', 'LIKE'}(line 1, pos 20)

== SQL ==
SHOW TABLE EXTENDED PARTITION(c='Us', d=1)
--------------------^^^


-- !query
SHOW TABLE EXTENDED LIKE 'show_t*' PARTITION(c='Us', d=1)
-- !query schema
struct<>
-- !query output
org.apache.spark.sql.catalyst.analysis.NoSuchTableException
Table or view 'show_t*' not found in database 'showdb'


-- !query
SHOW TABLE EXTENDED LIKE 'show_t1' PARTITION(c='Us')
-- !query schema
struct<>
-- !query output
org.apache.spark.sql.AnalysisException
Partition spec is invalid. The spec (c) must match the partition spec (c, d) defined in table '`showdb`.`show_t1`'


-- !query
SHOW TABLE EXTENDED LIKE 'show_t1' PARTITION(a='Us', d=1)
-- !query schema
struct<>
-- !query output
org.apache.spark.sql.AnalysisException
a is not a valid partition column in table `showdb`.`show_t1`.


-- !query
SHOW TABLE EXTENDED LIKE 'show_t1' PARTITION(c='Ch', d=1)
-- !query schema
struct<>
-- !query output
org.apache.spark.sql.catalyst.analysis.NoSuchPartitionException
Partition not found in table 'show_t1' database 'showdb':
c -> Ch
d -> 1


-- !query
DROP TABLE show_t1
-- !query schema
struct<>
-- !query output



-- !query
DROP TABLE show_t2
-- !query schema
struct<>
-- !query output



-- !query
DROP VIEW show_t3
-- !query schema
struct<>
-- !query output



-- !query
DROP VIEW global_temp.show_t4
-- !query schema
struct<>
-- !query output



-- !query
USE default
-- !query schema
struct<>
-- !query output



-- !query
DROP DATABASE showdb
-- !query schema
struct<>
-- !query output

0 comments on commit 423796f

Please sign in to comment.