Skip to content

Conversation

@cloud-fan
Copy link
Contributor

What changes were proposed in this pull request?

CreateViewCommand only needs some information of a CatalogTable, but not all of them. We have some tricks(e.g. we need to check the table type is VIEW, we need to make CatalogColumn.dataType nullable) to allow it to take a CatalogTable.
This PR cleans it up and only pass in necessary information to CreateViewCommand.

How was this patch tested?

existing tests.

@cloud-fan
Copy link
Contributor Author

cc @yhuai @liancheng

@SparkQA
Copy link

SparkQA commented Jul 21, 2016

Test build #62661 has finished for PR 14297 at commit 26312b9.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jul 21, 2016

Test build #62663 has finished for PR 14297 at commit 7e516ff.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jul 21, 2016

Test build #62671 has finished for PR 14297 at commit 3e22096.

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

originalText = None,
child = logicalPlan,
allowExisting = false,
replace = true,
Copy link
Member

Choose a reason for hiding this comment

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

createOrReplaceTempView and createTempView share all the input values, except this replace. Should we create a private help function to avoid duplicate codes?

@SparkQA
Copy link

SparkQA commented Jul 22, 2016

Test build #62701 has finished for PR 14297 at commit 5072959.

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

@cloud-fan
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Jul 25, 2016

Test build #62775 has finished for PR 14297 at commit 5072959.

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

@SparkQA
Copy link

SparkQA commented Jul 25, 2016

Test build #62786 has finished for PR 14297 at commit a5cf2b3.

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

originalText: Option[String],
child: LogicalPlan,
allowExisting: Boolean,
replace: Boolean,
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we replace allowExisting and replace with SaveMode? We have the following mapping here:

allowExisting replace SaveMode
true false Ignore
false false ErrorIfExists
false true Overwrite
true true Overwrite

Append can't be used here though.

Copy link
Contributor Author

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 it in another PR, to move SaveMode into catalyst module and use it for CREATE TABLE/VIEW

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea, sure.

Copy link
Contributor

Choose a reason for hiding this comment

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

btw, we can rename allowExisting to ignoreIfExists. I am not sure we need to SaveMode (a public API) to catalyst.

if (!isTemporary) {
require(tableDesc.viewText.isDefined,
require(originalText.isDefined,
"The table to created with CREATE VIEW must have 'viewText'.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: "viewText" to "originalText".

@liancheng
Copy link
Contributor

LGTM except for one minor issue.

@SparkQA
Copy link

SparkQA commented Jul 25, 2016

Test build #62818 has finished for PR 14297 at commit 7b78e20.

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

@liancheng
Copy link
Contributor

Merging to master, thanks!

@asfgit asfgit closed this in d27d362 Jul 25, 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