Skip to content

Conversation

@viirya
Copy link
Member

@viirya viirya commented Jan 8, 2016

JIRA: https://issues.apache.org/jira/browse/SPARK-12687

Some queries such as (select 1 as a) union (select 2 as a) can't work. This patch fixes it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to test fix by adding these to the parser unit test without running the queries?

As we develop more and more Spark features, I'd like to encourage doing actual unit tests or integration tests that run the minimal required code.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1, these could be added into CatalystQlSuite

Copy link
Member Author

Choose a reason for hiding this comment

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

ok. I added it here in order to make sure the results are correct. I will move it to CatalystQlSuite.

@rxin
Copy link
Contributor

rxin commented Jan 8, 2016

cc @davies

Copy link
Contributor

Choose a reason for hiding this comment

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

How does the order matter? Don't really understand ANTLR3, thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it matters. Without changing the order, select * from ((select 1 as a) union (select 1 as a)) t doesn't work because ((select 1 as a) union will be parsed as LPAREN joinSource RPAREN first and the parser will complain wrong input '(' expecting ) near union.

@SparkQA
Copy link

SparkQA commented Jan 8, 2016

Test build #49009 has finished for PR 10660 at commit fc5587e.

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we nest this rule? It seems a bit redundant to repeat the match rule twice.

Copy link
Member Author

Choose a reason for hiding this comment

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

Because in the following we need to access some of the sub clauses such as selectClause, clusterByClause, etc., with the syntax seems we can't simply extract the common part as a single rule.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, just tried this. My suggestion does not due to the set handling.

@hvanhovell
Copy link
Contributor

LGTM

@davies
Copy link
Contributor

davies commented Jan 8, 2016

Merging this into master, thanks!

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