Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Sep 9, 2019

What changes were proposed in this pull request?

Backporting the pullrequest 25570 to branch-2.4

Moving the call for checkColumnNameDuplication out of generateViewProperties. This way we can choose ifcheckColumnNameDuplication will be performed on analyzed or aliased plan without having to pass an additional argument(aliasedPlan) to generateViewProperties.

Before the pr column name duplication was performed on the query output of below sql(c1, c1) and the pr makes it perform check on the user provided schema of view definition(c1, c2)

Why are the changes needed?

Changes are to fix SPARK-23519 bug. Below queries would cause an exception. This pr fixes them and also added a test case.

CREATE TABLE t23519 AS SELECT 1 AS c1 CREATE VIEW v23519 (c1, c2) AS SELECT c1, c1 FROM t23519

Does this PR introduce any user-facing change?
No

How was this patch tested?
new unit test added in SQLViewSuite

@cloud-fan cloud-fan changed the title [SPARK-23519][SQL] Backporting to 2.4. Create view should work from query with duplicate output columns [SPARK-23519][SQL][2.4] Create view should work from query with duplicate output columns Sep 9, 2019
@cloud-fan
Copy link
Contributor

ok to test

@SparkQA
Copy link

SparkQA commented Sep 9, 2019

Test build #110363 has finished for PR 25733 at commit d7b5087.

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

@maropu
Copy link
Member

maropu commented Sep 9, 2019

retest this please

@SparkQA
Copy link

SparkQA commented Sep 10, 2019

Test build #110373 has finished for PR 25733 at commit d7b5087.

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

@cloud-fan
Copy link
Contributor

thanks, merging to 2.4!

@cloud-fan cloud-fan closed this Sep 10, 2019
cloud-fan pushed a commit that referenced this pull request Sep 10, 2019
…cate output columns

**What changes were proposed in this pull request?**

Backporting the pullrequest [25570](#25570) to branch-2.4

Moving the call for checkColumnNameDuplication out of generateViewProperties. This way we can choose ifcheckColumnNameDuplication will be performed on analyzed or aliased plan without having to pass an additional argument(aliasedPlan) to generateViewProperties.

Before the pr column name duplication was performed on the query output of below sql(c1, c1) and the pr makes it perform check on the user provided schema of view definition(c1, c2)

**Why are the changes needed?**

Changes are to fix SPARK-23519 bug. Below queries would cause an exception. This pr fixes them and also added a test case.

`CREATE TABLE t23519 AS SELECT 1 AS c1 CREATE VIEW v23519 (c1, c2) AS SELECT c1, c1 FROM t23519`

Does this PR introduce any user-facing change?
No

**How was this patch tested?**
new unit test added in SQLViewSuite

Closes #25733 from hem1891/SPARK-23519-backport-to-2.4.

Lead-authored-by: hemanth meka <hmeka@tibco.com>
Co-authored-by: hem1891 <hem1891@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
@xyxiaoyou
Copy link

Hi, @cloud-fan ,I need your help to solve a problem, which is the 'with as select' statement in spark SQL. How can I not execute the 'create view' statement?
Because this seriously affects the efficiency of creating views (the statement with as select is particularly complex and has a large amount of data).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants