Skip to content

Conversation

@gatorsmile
Copy link
Member

What changes were proposed in this pull request?

HQL Syntax: Create View

CREATE VIEW [IF NOT EXISTS] [db_name.]view_name [(column_name [COMMENT column_comment], ...) ]
  [COMMENT view_comment]
  [TBLPROPERTIES (property_name = property_value, ...)]
  AS SELECT ...;

Add a support for the [COMMENT view_comment] clause

How was this patch tested?

Modified the existing test cases to verify the correctness.

gatorsmile and others added 30 commits November 13, 2015 14:50
@SparkQA
Copy link

SparkQA commented Apr 10, 2016

Test build #55481 has finished for PR 12288 at commit 9c6ab48.

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

@gatorsmile
Copy link
Member Author

cc @yhuai @andrewor14 Thanks!

private def createView(
ctx: ParserRuleContext,
name: TableIdentifierContext,
description: Option[String],
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we just call it comment? Or, are we using description in other places?

Copy link
Member Author

Choose a reason for hiding this comment

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

https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala#L268

CatalogDatabase uses description as comment. Maybe comment is more straightforward. Let me change it. Thanks!

@yhuai
Copy link
Contributor

yhuai commented Apr 10, 2016

@gatorsmile Thank you for working on it. How about we hold off the change until we merge https://github.com/apache/spark/pull/12271/files? That PR is adding the field for comment in the CatalogTable.

@gatorsmile
Copy link
Member Author

Sure, no problem. : )

@SparkQA
Copy link

SparkQA commented Apr 10, 2016

Test build #55485 has finished for PR 12288 at commit 6f0f4cb.

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

@SparkQA
Copy link

SparkQA commented Apr 14, 2016

Test build #55785 has finished for PR 12288 at commit bfa4ea5.

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

@gatorsmile
Copy link
Member Author

@yhuai @andrewor14 @cloud-fan @liancheng

After the merge of Create Table, this PR is changed by using the latest CatalogTable. It is ready for review. Thanks!

sql(s"CREATE VIEW $viewName COMMENT 'no comment' AS SELECT * FROM $tabName")
val tableMetadata = catalog.getTableMetadata(TableIdentifier(tabName, Some("default")))
val viewMetadata = catalog.getTableMetadata(TableIdentifier(viewName, Some("default")))
assert(tableMetadata.properties.filter(_._1 != "transient_lastDdlTime")
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like to do assert(tableMetadata.properties.get("comment") == "BLABLA")

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, do it now. Thanks!

@cloud-fan
Copy link
Contributor

LGTM except one minor comment

@SparkQA
Copy link

SparkQA commented Apr 14, 2016

Test build #55816 has finished for PR 12288 at commit df4f5c2.

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

@yhuai
Copy link
Contributor

yhuai commented Apr 14, 2016

Thanks. Merging to master.

@asfgit asfgit closed this in 3cf3db1 Apr 14, 2016
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