Skip to content
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

[SPARK-17932][SQL] Support SHOW TABLES EXTENDED LIKE 'identifier_with_wildcards' statement #15958

Closed
wants to merge 3 commits into from

Conversation

jiangxb1987
Copy link
Contributor

@jiangxb1987 jiangxb1987 commented Nov 21, 2016

What changes were proposed in this pull request?

Currently we haven't implemented SHOW TABLE EXTENDED in Spark 2.0. This PR is to implement the statement.
Goals:

  1. Support SHOW TABLES EXTENDED LIKE 'identifier_with_wildcards';
  2. Explicitly output an unsupported error message for SHOW TABLES [EXTENDED] ... PARTITION statement;
  3. Improve test cases for SHOW TABLES statement.

How was this patch tested?

  1. Add new test cases in file show-tables.sql.
  2. Modify tests for SHOW TABLES in DDLSuite.

@SparkQA
Copy link

SparkQA commented Nov 21, 2016

Test build #68926 has started for PR 15958 at commit 89d4f5d.

@jiangxb1987
Copy link
Contributor Author

retest this please.

@SparkQA
Copy link

SparkQA commented Nov 21, 2016

Test build #68943 has finished for PR 15958 at commit 89d4f5d.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@jiangxb1987
Copy link
Contributor Author

cc @hvanhovell @gatorsmile

@gatorsmile
Copy link
Member

cc @dilipbiswal The original code was wrote by you. Could you review it? Thanks!

@dilipbiswal
Copy link
Contributor

@gatorsmile Thank you for cc'ing me. Overall it looks good to me.
I have a few observations/comments that i would list below which hopefully should help us
decide.

  1. Hive actually has two commands i) show tables ii) show table and the extended
    switch is applicable for the "show table" command. Have we decided to merge
    the semantics of these two commands in an effort to similify ?

  2. As a side effect, we actually print the database name and table name two times.
    Is that ok ?

  3. The format of hive seems better as there is a newline between two tables. I created
    a regular table and a temporary view with same prefix and tried the command. Its very
    difficult to distinguish the output between table and view. here is how it looks.

spark-sql> create table realtable(c1 int) using parquet;
Time taken: 0.467 seconds
spark-sql> create temporary view realview (c1 int, c2 int) using parquet;
Time taken: 0.053 seconds
spark-sql> show tables extended like 'real*';
default	realtable	false	CatalogTable(
	Table: `default`.`realtable`
	Owner: cloudera
	Created: Tue Nov 22 17:41:56 PST 2016
	Last Access: Wed Dec 31 16:00:00 PST 1969
	Type: MANAGED
	Schema: [StructField(c1,IntegerType,true)]
	Provider: parquet
	Properties: [transient_lastDdlTime=1479865316]
	Storage(Location: file:/user/hive/warehouse/realtable, InputFormat: org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat, OutputFormat: org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat, Serde: org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe, Properties: [serialization.format=1]))
	realview	true	CatalogTable(
	Table: `realview`
	Created: Tue Nov 22 17:42:28 PST 2016
	Last Access: Wed Dec 31 15:59:59 PST 1969
	Type: VIEW
	Schema: [StructField(c1,IntegerType,true), StructField(c2,IntegerType,true)]
	Storage())
Time taken: 0.104 seconds, Fetched 2 row(s)

@jiangxb1987
Copy link
Contributor Author

@dilipbiswal Thank you for reviewing this PR! I want to share my thoughts about the questions:

  1. Perhaps using the same semantics is better IMO, because that'll be less comfusing. I've often mistype between show table and show tables in HIVE;
  2. I'm neutral to the issue whether we should still print the database name and the table name when we have printed the extended information;
  3. +1 for that the format should be improved, perhaps add one empty line after each row?

@SparkQA
Copy link

SparkQA commented Nov 24, 2016

Test build #69128 has finished for PR 15958 at commit a3db00f.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@gatorsmile
Copy link
Member

Could you update the PR title? The current one is confusing. This PR is not a bug fix.

@jiangxb1987 jiangxb1987 changed the title [SPARK-17932][SQL] Failed to run SQL "show table extended like table_name" in Spark2.0.0 [SPARK-17932][SQL] Support SHOW TABLES EXTENDED LIKE 'identifier_with_wildcards' statement Nov 27, 2016
@jiangxb1987
Copy link
Contributor Author

@gatorsmile I've updated the title, thank you!

@gatorsmile
Copy link
Member

The Non-Goals in the PR description is also confusing. Basically, what this PR does is to explicitly output an unsupported error message if users specify PARTITION. Could you also update that? Thanks!

}

override def run(sparkSession: SparkSession): Seq[Row] = {
if (isExtended && !tableIdentifierPattern.isDefined) {
throw new AnalysisException(
s"SHOW TABLES EXTENDED must have identifier_with_wildcards specified.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throw this exception when creating the class. This is to late.

@SparkQA
Copy link

SparkQA commented Nov 30, 2016

Test build #69393 has started for PR 15958 at commit 958fe8b.

@jiangxb1987
Copy link
Contributor Author

retest this please.

@SparkQA
Copy link

SparkQA commented Nov 30, 2016

Test build #69395 has finished for PR 15958 at commit 958fe8b.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@hvanhovell
Copy link
Contributor

LGTM. Merging to master. Thanks!

@asfgit asfgit closed this in c24076d Nov 30, 2016
| SHOW TABLES ((FROM | IN) db=identifier)?
(LIKE? pattern=STRING)? #showTables
| SHOW TABLES EXTENDED? ((FROM | IN) db=identifier)?
(LIKE? pattern=STRING)? partitionSpec? #showTables
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Syntax is different from Hive.

SHOW TABLE EXTENDED [IN|FROM database_name] LIKE 'identifier_with_wildcards' [PARTITION(partition_spec)];

@gatorsmile
Copy link
Member

@jiangxb1987 Could you submit a follow-up PR to correct it? Thanks!

@jiangxb1987
Copy link
Contributor Author

@gatorsmile Could you explicitly point out which part should be modified? IMO we don't follow the HIVE syntax unconditionally. Thanks!

@gatorsmile
Copy link
Member

If needed, we should not break the consistency. For example, SHOW TABLE and SHOW TABLES are different.

robert3005 pushed a commit to palantir/spark that referenced this pull request Dec 2, 2016
…_wildcards' statement

## What changes were proposed in this pull request?

Currently we haven't implemented `SHOW TABLE EXTENDED` in Spark 2.0. This PR is to implement the statement.
Goals:
1. Support `SHOW TABLES EXTENDED LIKE 'identifier_with_wildcards'`;
2. Explicitly output an unsupported error message for `SHOW TABLES [EXTENDED] ... PARTITION` statement;
3. Improve test cases for `SHOW TABLES` statement.

## How was this patch tested?
1. Add new test cases in file `show-tables.sql`.
2. Modify tests for `SHOW TABLES` in `DDLSuite`.

Author: jiangxingbo <[email protected]>

Closes apache#15958 from jiangxb1987/show-table-extended.
@jiangxb1987 jiangxb1987 deleted the show-table-extended branch December 9, 2016 10:51
uzadude pushed a commit to uzadude/spark that referenced this pull request Jan 27, 2017
…_wildcards' statement

## What changes were proposed in this pull request?

Currently we haven't implemented `SHOW TABLE EXTENDED` in Spark 2.0. This PR is to implement the statement.
Goals:
1. Support `SHOW TABLES EXTENDED LIKE 'identifier_with_wildcards'`;
2. Explicitly output an unsupported error message for `SHOW TABLES [EXTENDED] ... PARTITION` statement;
3. Improve test cases for `SHOW TABLES` statement.

## How was this patch tested?
1. Add new test cases in file `show-tables.sql`.
2. Modify tests for `SHOW TABLES` in `DDLSuite`.

Author: jiangxingbo <[email protected]>

Closes apache#15958 from jiangxb1987/show-table-extended.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants