-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-11398][SQL] unnecessary def dialectClassName in HiveContext, and misleading dialect conf at the start of spark-sql #9349
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
Conversation
|
I also delete def dialectClassName. It's useless because getSQLDialect() is enough for selecting dialect. |
|
@wzhfy Currently, we can use |
|
@davies My intention is to change the displayed dialect when spark-sql starts, not to set "hiveql" for HiveContext forever. Here's my description of the problem in JIRA: After the change, we can still use "sql" as the dialect for HiveContext through "set spark.sql.dialect=sql". This is the same way as before to switch between the two dialects, right? |
|
@davies @liancheng I've updated the description of this problem, hoping to explain it better now. |
|
Test build #1972 has finished for PR 9349 at commit
|
|
@wzhfy The first part change is good (remove dialectClassName). But other one may introduce regression, when you have |
…ct conf at the start of spark-sql
|
@davies Thanks for the advice. The commit is updated, please check if that's what we want. Btw, I think the cause of this problem is the inconsistency between the default dialect conf (sql) and the default sqlcontext (HiveContext), maybe we should fix that in the future. |
|
@wzhfy The changes LGTM, could you update the description to reflect the changes? |
|
Test build #1975 has finished for PR 9349 at commit
|
|
@davies The description is updated |
|
Merged into master, thanks! |
In HiveContext, if conf.dialect == "hiveql", getSQLDialect() will return new HiveQLDialect(this);
else it will use super.getSQLDialect(). Then in super.getSQLDialect(), it calls dialectClassName, which is overriden in HiveContext and still return super.dialectClassName.
So we'll never reach the code "classOf[HiveQLDialect].getCanonicalName" of def dialectClassName in HiveContext.
However, if we type "set spark.sql.dialect;", the result is "sql", which is inconsistent with the actual dialect and is misleading. For example, we can use sql like "create table" which is only allowed in hiveql, but this dialect conf shows it's "sql".
Although this problem will not cause any execution error, it's misleading to spark sql users. Therefore I think we should fix it.
In this pr, while procesing “set spark.sql.dialect” in SetCommand, I use "conf.dialect" instead of "getConf()" for the case of key == SQLConf.DIALECT.key, so that it will return the right dialect conf.