Uh oh!
There was an error while loading. Please reload this page.
[SPARK-21054] [SQL] Reset Command support reset specific property. - #18268
[SPARK-21054] [SQL] Reset Command support reset specific property.#18268ericsahit wants to merge 9 commits into
Conversation
ericsahit
commented
Jun 11, 2017
cc @rxin@gatorsmile@cloud-fan Could you please review this? Thanks! |
There was a problem hiding this comment.
No need to mention Hive here. Just need to explain the semantics.
gatorsmile
commented
Jun 12, 2017
ok to test |
There was a problem hiding this comment.
You can use map to shorten it to a single line.
There was a problem hiding this comment.
Have been fixed typo except here, @gatorsmile could you please explain a little more? Thanks!
There was a problem hiding this comment.
uh... This is a String. Then, we just need to shorten it to a single line
if (raw.nonEmpty) ResetCommand(Some(raw.trim)) elseResetCommand(None)There was a problem hiding this comment.
Nit: Just use a few lines to implement logics here. No need to add the extra function.
SparkQA
commented
Jun 12, 2017
Test build #77918 has started for PR 18268 at commit |
SparkQA
commented
Jun 13, 2017
Test build #77965 has started for PR 18268 at commit |
There was a problem hiding this comment.
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)
...
}There was a problem hiding this comment.
After done this, building threw SQLConfSuite is not a test, maybe this style does not work. @gatorsmile
There was a problem hiding this comment.
what about
RESET `special#$!`?
ericsahit
commented
Jun 13, 2017
ok, i have fix typo and code stye according to your comments. @gatorsmile@cloud-fan any suggestion would be welcome. Thanks! |
There was a problem hiding this comment.
actually I was asking about what's hive's behavior for this case...
There was a problem hiding this comment.
you mean there has special character in property name? Hive will also take this special#$! as a property name, play same behavior with SparkSQL.
Internally it take rest of command part as property name.
There was a problem hiding this comment.
Internally it take rest of command part as property name.
What if there's a space or other punctuation? e.g.reset prop1 prop2;. Hive treats it like one property, two properties, or throws error?
SparkQA
commented
Jun 13, 2017
Test build #77983 has finished for PR 18268 at commit
|
SparkQA
commented
Jun 13, 2017
Test build #77984 has finished for PR 18268 at commit
|
There was a problem hiding this comment.
-> test(s"reset - user-defined conf $resetCmd") {
There was a problem hiding this comment.
Please do the same for the others.
There was a problem hiding this comment.
+1, otherwise we will have tests with same name
There was a problem hiding this comment.
can we add a test for
reset `#a!`
There was a problem hiding this comment.
ok, now added one plus sql-parse test for reset special character.
SparkQA
commented
Jun 15, 2017
Test build #78106 has finished for PR 18268 at commit
|
ericsahit
commented
Jun 15, 2017
cc @gatorsmile@cloud-fan thanks for reviewing. Any extra suggestion would be welcome |
| test("reset") { | ||
| assertEqual("reset", ResetCommand(None)) | ||
| assertEqual("reset spark.test.property", ResetCommand(Some("spark.test.property"))) | ||
| assertEqual("reset #$a!", ResetCommand(Some("#$a!"))) |
There was a problem hiding this comment.
can we check hive's behavior? I think special chars are not allowed in config name and parser should throw exception for this case.
There was a problem hiding this comment.
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)>
Hive supports reset multiple keys like: |
ericsahit
commented
Jun 16, 2017
@gatorsmile@cloud-fan , @wzhfy just give an extra propose, should we support reset multiple property? I make a hive test like: |
gatorsmile
commented
Jun 16, 2017
Yes. Please do it. |
gatorsmile
commented
Jun 25, 2017
ping @ericsahit |
SparkQA
commented
Jun 25, 2017
Test build #78576 has finished for PR 18268 at commit
|
ericsahit
commented
Jun 25, 2017
@gatorsmile Sorry for the delay, I just add this And more, fail of unit test seems not related with this patch. |
SparkQA
commented
Jun 25, 2017
Test build #78579 has finished for PR 18268 at commit
|
cloud-fan
commented
Jun 26, 2017
retest this please |
| assert(spark.conf.get(SQLConf.GROUP_BY_ORDINAL) === true) | ||
| assert(sql(s"set").where(s"key = '${SQLConf.GROUP_BY_ORDINAL.key}'").count() == 0) | ||
| } finally { | ||
| sql(s"set ${SQLConf.GROUP_BY_ORDINAL}=$original") |
There was a problem hiding this comment.
not introduced in this PR, but we don't need to do this as we call spark.sessionState.conf.clear() at the beginning.
There was a problem hiding this comment.
Would you mean it is a duplicated clean action? I suppose the purpose is to prevent impact of other tests..
There was a problem hiding this comment.
I think this is OK. After clear(), original gets the default value of the config, so here it wants to keep the default value unchanged.
| } finally { | ||
| sql(s"set ${SQLConf.GROUP_BY_ORDINAL}=$original") | ||
| Seq("reset", s"reset ${SQLConf.GROUP_BY_ORDINAL.key}").foreach { resetCmd => | ||
| test(s"reset - public conf $resetCmd") { |
There was a problem hiding this comment.
nit: seems better to make the test name s"$resetCmd - public conf"
There was a problem hiding this comment.
done, sounds like a more reasonable name
SparkQA
commented
Jun 26, 2017
Test build #78617 has finished for PR 18268 at commit
|
SparkQA
commented
Jun 26, 2017
Test build #78630 has finished for PR 18268 at commit
|
cloud-fan
commented
Jun 26, 2017
retest this please |
SparkQA
commented
Jun 26, 2017
Test build #78633 has finished for PR 18268 at commit
|
| sparkSession.sessionState.conf.clear() | ||
| // "RESET key" clear a specific property. | ||
| case Some(key) => | ||
| key.split("\\s+") |
There was a problem hiding this comment.
What happened if the space is part of the property key? For example,RESET `a b` `c d` ?
There was a problem hiding this comment.
OK, i plan adding Quoted Identifiers support for such special situation, after all Quote symbol will be the only special delimiter. final use case like this:
spark-sql> set a b=1;
key value
a b 1
Time taken: 0.018 seconds, Fetched 1 row(s)
spark-sql> set c d=2;
key value
c d 2
Time taken: 0.018 seconds, Fetched 1 row(s)
spark-sql> reset a b c d;
Time taken: 0.01 seconds
spark-sql> set a b;
key value
a b 1
spark-sql> reset `a b` `c d`;
Time taken: 0.01 seconds
spark-sql> set a b;
key value
a b <undefined>
Time taken: 0.016 seconds, Fetched 1 row(s)
spark-sql> set c d;
key value
c d <undefined>
spark-sql> reset `a b;
Error in query: Invalid usage of '`' in expression;
I though we should open another issue,
gatorsmile
commented
Aug 6, 2017
ping @ericsahit Could you update your PR with extra changes like #18368 ? |
gatorsmile
commented
Oct 23, 2017
ping @ericsahit |
AmplabJenkins
commented
Jun 9, 2018
Can one of the admins verify this patch? |
Closesapache#17422Closesapache#17619Closesapache#18034Closesapache#18229Closesapache#18268Closesapache#17973Closesapache#18125Closesapache#18918Closesapache#19274Closesapache#19456Closesapache#19510Closesapache#19420Closesapache#20090Closesapache#20177Closesapache#20304Closesapache#20319Closesapache#20543Closesapache#20437Closesapache#21261Closesapache#21726Closesapache#14653Closesapache#13143Closesapache#17894Closesapache#19758Closesapache#12951Closesapache#17092Closesapache#21240Closesapache#16910Closesapache#12904Closesapache#21731Closesapache#21095 Added: Closesapache#19233Closesapache#20100Closesapache#21453Closesapache#21455Closesapache#18477 Added: Closesapache#21812Closesapache#21787 Author: hyukjinkwon <gurwls223@apache.org> Closesapache#21781 from HyukjinKwon/closing-prs.
What changes were proposed in this pull request?
Reset Command support reset specific property to default value like
reset spark.test.property.Hive 2.1.1 (HIVE-14418) support Reset Command for specific property like
reset spark.test.property, which will throw error in SparkSQL.Compatibility will lower the cost for transferring SQL in production from Hive to SparkSQL.
How was this patch tested?
Add unit tests.
Please review http://spark.apache.org/contributing.html before opening a pull request.