Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-12982][SQL] Add table name validation in temp table registration #11051

Closed

Conversation

jayadevanmurali
Copy link
Contributor

Add the table name validation at the temp table creation

 Add table name validation in temp table registration
Added test case for validating table name
@@ -1291,4 +1291,14 @@ class DataFrameSuite extends QueryTest with SharedSQLContext {
Seq(1 -> "a").toDF("i", "j").filter($"i".cast(StringType) === "1"),
Row(1, "a"))
}

test("SPARK-12982: Add table name validation in temp table registration") {
val rows = List(Row("foo"), Row("bar"))
Copy link
Contributor

Choose a reason for hiding this comment

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

We can be a bit more concise: val df = Seq("foo", "bar").map(Tuple1.apply).toDF("col")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@hvanhovell OK I will do the change

@davies
Copy link
Contributor

davies commented Feb 3, 2016

Jenkins, OK to test

@hvanhovell
Copy link
Contributor

ok to test

@hvanhovell
Copy link
Contributor

@davies can you trigger a test?

@SparkQA
Copy link

SparkQA commented Feb 4, 2016

Test build #2516 has finished for PR 11051 at commit 3407fd7.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Removed extra white space.
@jayadevanmurali
Copy link
Contributor Author

@SparkQA Could you please test again

@SparkQA
Copy link

SparkQA commented Feb 4, 2016

Test build #2517 has finished for PR 11051 at commit 4c25f2e.

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

Modified test case by including more valid and invalid table names
@jayadevanmurali
Copy link
Contributor Author

@SparkQA
Could you please do a test again

@hvanhovell @davies
Incorporated review comments in test case. Could you please review the same

@@ -1291,4 +1291,19 @@ class DataFrameSuite extends QueryTest with SharedSQLContext {
Seq(1 -> "a").toDF("i", "j").filter($"i".cast(StringType) === "1"),
Row(1, "a"))
}

test("SPARK-12982: Add table name validation in temp table registration") {
val rows = List(Row("foo"), Row("bar"))
Copy link
Contributor

Choose a reason for hiding this comment

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

We can be a bit more concise (also see the comment in the previous PR): val df = Seq(("one", "two")).toDF("a", "b")

@hvanhovell
Copy link
Contributor

retest this please

@jayadevanmurali
Copy link
Contributor Author

@hvanhovell
I will make that change now.

@hvanhovell
Copy link
Contributor

@jayadevanmurali you can request a retest by making a retest this please comment. The Jenkins PR builder will pick this up. See https://github.com/jenkinsci/ghprb-plugin/blob/master/README.md for more information.

@jayadevanmurali
Copy link
Contributor Author

Thanks @hvanhovell for this info

Incorporated review comments, Make the code more concise
@jayadevanmurali
Copy link
Contributor Author

retest this please

@hvanhovell
Copy link
Contributor

LGTM pending tests

@SparkQA
Copy link

SparkQA commented Feb 8, 2016

Test build #2523 has finished for PR 11051 at commit d576496.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.


test("SPARK-12982: Add table name validation in temp table registration") {
val df = Seq("foo", "bar").map(Tuple1.apply).toDF("col")
//invalid table name test as below
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to add a space between // and the actual comment in order to pass style checks.

Insert one white space at the beginning of the comment.
@jayadevanmurali
Copy link
Contributor Author

Jenkins, retest this please

@hvanhovell
Copy link
Contributor

retest this please

@jayadevanmurali
Copy link
Contributor Author

@SparkQA
Could you please retest the changes

@hvanhovell
Copy link
Contributor

retest this please

@jayadevanmurali
Copy link
Contributor Author

@hvanhovell @davies
Why this much delay for test ? Is any action required from me?

@jayadevanmurali
Copy link
Contributor Author

retest this please

1 similar comment
@hvanhovell
Copy link
Contributor

retest this please

@hvanhovell
Copy link
Contributor

@jayadevanmurali I have no idea why builds aren't triggered (they should be). I haven't got the proper Jenkins rights to trigger a build yet.

@hvanhovell
Copy link
Contributor

ok to test

@SparkQA
Copy link

SparkQA commented Feb 10, 2016

Test build #2530 has finished for PR 11051 at commit f3c7bbb.

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

// another invalid table name test as below
intercept[AnalysisException](df.registerTempTable("#$@sum"))
// another invalid table name test as below
intercept[AnalysisException](df.registerTempTable("table!#"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmmm... this one should fail. Let me submit a PR for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this a new bug ?

Copy link
Contributor

Choose a reason for hiding this comment

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

It is a bug, but it was in code base already. The fix is trivial (I need to add a separate rule for parsing table identifiers - which checks for an EOF).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok thanks for the info. Let me know if you need any help from me.

asfgit pushed a commit that referenced this pull request Feb 11, 2016
…xpression string

The parser currently parses the following strings without a hitch:
* Table Identifier:
  * `a.b.c` should fail, but results in the following table identifier `a.b`
  * `table!#` should fail, but results in the following table identifier `table`
* Expression
  * `1+2 r+e` should fail, but results in the following expression `1 + 2`

This PR fixes this by adding terminated rules for both expression parsing and table identifier parsing.

cc cloud-fan (we discussed this in #10649) jayadevanmurali (this causes your PR #11051 to fail)

Author: Herman van Hovell <hvanhovell@questtec.nl>

Closes #11159 from hvanhovell/SPARK-13276.
@jayadevanmurali
Copy link
Contributor Author

@hvanhovell Thanks for the quick fix, I think we can retest this PR now. What you think ?

@hvanhovell
Copy link
Contributor

retest this please

@jayadevanmurali
Copy link
Contributor Author

@hvanhovell I think, you may comment "ok to test" for triggering the build

@hvanhovell
Copy link
Contributor

ok to test

@hvanhovell
Copy link
Contributor

@jayadevanmurali issueing retest this please should normally do the trick.

@hvanhovell
Copy link
Contributor

@jayadevanmurali Jenkins will be restarted in 30 mins. Lets try again after that.

@hvanhovell
Copy link
Contributor

retest this please

@jayadevanmurali
Copy link
Contributor Author

Ok. I think something missing in our test request, lot test started now which all requested after our PR

@jayadevanmurali
Copy link
Contributor Author

Jenkins, test this please

@hvanhovell
Copy link
Contributor

ok to test

@hvanhovell
Copy link
Contributor

@shaneknapp any idea why Jenkins is not picking this up?

@shaneknapp
Copy link
Contributor

jenkins test this please

@shaneknapp
Copy link
Contributor

im not totally sure... jenkins is picking up other PRB builds. i'll poke around the (horrific) jenkins logs and see if i can't find out.

@shaneknapp
Copy link
Contributor

@hvanhovell
Copy link
Contributor

@shaneknapp thanks for your help! Any idea what caused this?

@SparkQA
Copy link

SparkQA commented Feb 11, 2016

Test build #51120 has finished for PR 11051 at commit f3c7bbb.

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

@shaneknapp
Copy link
Contributor

the GHPRB plugin is finicky, obtuse and opaque in it's operations. i have
no idea why it decided to not trigger, and the logs don't show anything.
sorry... :(

On Thu, Feb 11, 2016 at 11:07 AM, Herman van Hovell <
notifications@github.com> wrote:

@shaneknapp https://github.com/shaneknapp thanks for your help! Any
idea what caused this?


Reply to this email directly or view it on GitHub
#11051 (comment).

@hvanhovell
Copy link
Contributor

@shaneknapp Thanks for checking... The GHPRB just works in mysterious ways...

@hvanhovell
Copy link
Contributor

Merging to master. Thanks!

@asfgit asfgit closed this in 0d50a22 Feb 11, 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
5 participants