-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[SPARK-30282][SQL][FOLLOWUP] SHOW TBLPROPERTIES should support views #28375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
-- create a table with properties | ||
CREATE TABLE tbl (a INT, b STRING, c INT) USING parquet | ||
TBLPROPERTIES('p1'='v1', 'p2'='v2'); | ||
|
||
SHOW TBLPROPERTIES tbl; | ||
SHOW TBLPROPERTIES tbl("p1"); | ||
SHOW TBLPROPERTIES tbl("p3"); | ||
|
||
DROP TABLE tbl; | ||
|
||
-- create a view with properties | ||
CREATE VIEW view TBLPROPERTIES('p1'='v1', 'p2'='v2') AS SELECT 1 AS c1; | ||
|
||
SHOW TBLPROPERTIES view; | ||
SHOW TBLPROPERTIES view("p1"); | ||
SHOW TBLPROPERTIES view("p3"); | ||
|
||
DROP VIEW view; | ||
|
||
-- create a temporary view with properties | ||
CREATE TEMPORARY VIEW tv TBLPROPERTIES('p1'='v1') AS SELECT 1 AS c1; | ||
|
||
-- Properties for a temporary view should be empty | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW I'd treat this as a bug. I don't think anyone would expect This is an existing issue, we can deal with it later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cloud-fan I will create a PR for this. This can be misleading as you pointed out. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cloud-fan There are few ways to address this:
WDYT? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd vote for 3. We have many commands that named as XXX TABLE but can work for views. |
||
SHOW TBLPROPERTIES tv; | ||
|
||
DROP VIEW tv; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
-- Automatically generated by SQLQueryTestSuite | ||
-- Number of queries: 13 | ||
|
||
|
||
-- !query | ||
CREATE TABLE tbl (a INT, b STRING, c INT) USING parquet | ||
TBLPROPERTIES('p1'='v1', 'p2'='v2') | ||
-- !query schema | ||
struct<> | ||
-- !query output | ||
|
||
|
||
|
||
-- !query | ||
SHOW TBLPROPERTIES tbl | ||
-- !query schema | ||
struct<key:string,value:string> | ||
-- !query output | ||
p1 v1 | ||
p2 v2 | ||
|
||
|
||
-- !query | ||
SHOW TBLPROPERTIES tbl("p1") | ||
-- !query schema | ||
struct<value:string> | ||
-- !query output | ||
v1 | ||
|
||
|
||
-- !query | ||
SHOW TBLPROPERTIES tbl("p3") | ||
-- !query schema | ||
struct<value:string> | ||
-- !query output | ||
Table default.tbl does not have property: p3 | ||
|
||
|
||
-- !query | ||
DROP TABLE tbl | ||
-- !query schema | ||
struct<> | ||
-- !query output | ||
|
||
|
||
|
||
-- !query | ||
CREATE VIEW view TBLPROPERTIES('p1'='v1', 'p2'='v2') AS SELECT 1 AS c1 | ||
-- !query schema | ||
struct<> | ||
-- !query output | ||
|
||
|
||
|
||
-- !query | ||
SHOW TBLPROPERTIES view | ||
-- !query schema | ||
struct<key:string,value:string> | ||
-- !query output | ||
p1 v1 | ||
p2 v2 | ||
view.catalogAndNamespace.numParts 2 | ||
view.catalogAndNamespace.part.0 spark_catalog | ||
view.catalogAndNamespace.part.1 default | ||
view.query.out.col.0 c1 | ||
view.query.out.numCols 1 | ||
|
||
|
||
-- !query | ||
SHOW TBLPROPERTIES view("p1") | ||
-- !query schema | ||
struct<value:string> | ||
-- !query output | ||
v1 | ||
|
||
|
||
-- !query | ||
SHOW TBLPROPERTIES view("p3") | ||
-- !query schema | ||
struct<value:string> | ||
-- !query output | ||
Table default.view does not have property: p3 | ||
|
||
|
||
-- !query | ||
DROP VIEW view | ||
-- !query schema | ||
struct<> | ||
-- !query output | ||
|
||
|
||
|
||
-- !query | ||
CREATE TEMPORARY VIEW tv TBLPROPERTIES('p1'='v1') AS SELECT 1 AS c1 | ||
-- !query schema | ||
struct<> | ||
-- !query output | ||
|
||
|
||
|
||
-- !query | ||
SHOW TBLPROPERTIES tv | ||
-- !query schema | ||
struct<key:string,value:string> | ||
-- !query output | ||
|
||
|
||
|
||
-- !query | ||
DROP VIEW tv | ||
-- !query schema | ||
struct<> | ||
-- !query output | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can remove it. Exception class change doesn't worth a migration guide item.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This exception class change was brought up in this comment: #26921 (comment). Can I still remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think error message/exception type change is a breaking change. @dongjoon-hyun what do you think?