Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix and add more test case.
  • Loading branch information
wanghaihua committed Jun 15, 2017
commit 99436d624d028fd972d5ec94eaedcf1b639b23a7
Original file line number Diff line number Diff line change
Expand Up @@ -305,5 +305,6 @@ class SparkSqlParserSuite extends PlanTest {
test("reset") {
assertEqual("reset", ResetCommand(None))
assertEqual("reset spark.test.property", ResetCommand(Some("spark.test.property")))
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add a test for

reset `#a!`

Copy link
Author

Choose a reason for hiding this comment

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

ok, now added one plus sql-parse test for reset special character.

assertEqual("reset #$a!", ResetCommand(Some("#$a!")))
Copy link
Contributor

Choose a reason for hiding this comment

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

can we check hive's behavior? I think special chars are not allowed in config name and parser should throw exception for this case.

Copy link
Author

Choose a reason for hiding this comment

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

Hive 2.1.1 just play the but same behavior. I thought it is due to hardly define what is normal property as user can define property as they wish.
Hive case:

hive (temp)> set #$!@=1024;
hive (temp)> set #$!@;
#$!@=1024
hive (temp)>

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class SQLConfSuite extends QueryTest with SharedSQLContext {
}

Seq("reset", s"reset ${SQLConf.GROUP_BY_ORDINAL.key}").foreach { resetCmd =>
test("reset - public conf") {
test(s"reset - public conf $resetCmd") {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: seems better to make the test name s"$resetCmd - public conf"

Copy link
Author

@ericsahit ericsahit Jun 26, 2017

Choose a reason for hiding this comment

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

done, sounds like a more reasonable name

spark.sessionState.conf.clear()
val original = spark.conf.get(SQLConf.GROUP_BY_ORDINAL)
try {
Expand All @@ -133,7 +133,7 @@ class SQLConfSuite extends QueryTest with SharedSQLContext {
}
Copy link
Member

Choose a reason for hiding this comment

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

Let us combine the three newly added test cases with the existing ones. For example,

  Seq("reset", s"reset ${SQLConf.OPTIMIZER_MAX_ITERATIONS.key}").foreach { cmd =>
    test(s"$cmd - internal conf") {
      ...
        sql(cmd)
      ...
  }

Copy link
Author

Choose a reason for hiding this comment

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

After done this, building threw SQLConfSuite is not a test, maybe this style does not work. @gatorsmile


Seq("reset", s"reset ${SQLConf.OPTIMIZER_MAX_ITERATIONS.key}").foreach { resetCmd =>
test("reset - internal conf") {
test(s"reset - internal conf $resetCmd") {
spark.sessionState.conf.clear()
val original = spark.conf.get(SQLConf.OPTIMIZER_MAX_ITERATIONS)
try {
Expand All @@ -151,7 +151,7 @@ class SQLConfSuite extends QueryTest with SharedSQLContext {
}

Seq("reset", s"reset $testKey").foreach { resetCmd =>
test("reset - user-defined conf") {
test(s"reset - user-defined conf $resetCmd") {
spark.sessionState.conf.clear()
try {
assert(spark.conf.getOption(testKey).isEmpty)
Expand Down