Skip to content

Conversation

@cloud-fan
Copy link
Contributor

What changes were proposed in this pull request?

Currently we use CreateViewCommand to implement ALTER VIEW AS, which has 3 bugs:

  1. SPARK-17180: ALTER VIEW AS should alter temp view if view name has no database part and temp view exists
  2. SPARK-17309: ALTER VIEW AS should issue exception if view does not exist.
  3. SPARK-17323: ALTER VIEW AS should keep the previous table properties, comment, create_time, etc.

The root cause is, ALTER VIEW AS is quite different from CREATE VIEW, we need different code path to handle them. However, in CreateViewCommand, there is no way to distinguish ALTER VIEW AS and CREATE VIEW, we have to introduce extra flag. But instead of doing this, I think a more natural way is to separate the ALTER VIEW AS logic into a new command.

backport #14874 to 2.0

How was this patch tested?

new tests in SQLViewSuite

@cloud-fan
Copy link
Contributor Author

cc @yhuai

@SparkQA
Copy link

SparkQA commented Aug 31, 2016

Test build #64715 has finished for PR 14893 at commit 75935a8.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class AlterViewAsCommand(

@SparkQA
Copy link

SparkQA commented Aug 31, 2016

Test build #64720 has finished for PR 14893 at commit 6b32886.

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

asfgit pushed a commit that referenced this pull request Sep 1, 2016
…ommand to handle ALTER VIEW AS

## What changes were proposed in this pull request?

Currently we use `CreateViewCommand` to implement ALTER VIEW AS, which has 3 bugs:

1. SPARK-17180: ALTER VIEW AS should alter temp view if view name has no database part and temp view exists
2. SPARK-17309: ALTER VIEW AS should issue exception if view does not exist.
3. SPARK-17323: ALTER VIEW AS should keep the previous table properties, comment, create_time, etc.

The root cause is, ALTER VIEW AS is quite different from CREATE VIEW, we need different code path to handle them. However, in `CreateViewCommand`, there is no way to distinguish ALTER VIEW AS and CREATE VIEW, we have to introduce extra flag. But instead of doing this, I think a more natural way is to separate the ALTER VIEW AS logic into a new command.

backport #14874 to 2.0

## How was this patch tested?

new tests in SQLViewSuite

Author: Wenchen Fan <[email protected]>

Closes #14893 from cloud-fan/minor4.
@cloud-fan
Copy link
Contributor Author

merging to 2.0!

@cloud-fan cloud-fan closed this Sep 1, 2016
@cloud-fan cloud-fan deleted the minor4 branch December 14, 2016 12:33
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.

2 participants