-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-29983][SQL] Add an independent config for an optional INTERVAL clause #26623
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
|
one correction: the SQL standard actually requires the INTERVAL prefix |
| } | ||
|
|
||
| val OPTIONAL_INTERVAL = | ||
| buildConf("spark.sql.optionalInterval") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's put it under the spark.sql.parser namespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
Oh! I did misunderstand that.... thanks for the correction, @cloud-fan |
|
The PR descripion updated based on the suggsetion above. |
|
Test build #114223 has finished for PR 26623 at commit
|
|
Test build #114215 has finished for PR 26623 at commit
|
| lexer.addErrorListener(ParseErrorListener) | ||
| lexer.legacy_setops_precedence_enbled = conf.setOpsPrecedenceEnforced | ||
| lexer.SQL_standard_keyword_behavior = SQLStandardKeywordBehavior | ||
| lexer.optional_interval = conf.optionalInterval |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be dialect == Spark && ansi == true && optionalInterval
For pgsql diaelct, INTERVAL can't be optional. for non-ansi mode, year/month/day... are not reserved keywords and we can't ommit INTERVAL prefix anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
| } | ||
|
|
||
| val OPTIONAL_INTERVAL = | ||
| buildConf("spark.sql.parser.optionalInterval") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe "optionalIntervalPrefix"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
|
Test build #114235 has finished for PR 26623 at commit
|
02f54fd to
54a1f07
Compare
|
Test build #114237 has finished for PR 26623 at commit
|
|
Test build #114228 has finished for PR 26623 at commit
|
354b7a8 to
a23ee2c
Compare
a23ee2c to
5868ef1
Compare
| // into the head in this test. | ||
| val importedTestCaseName = comments.filter(_.startsWith("--IMPORT ")).map(_.substring(9)) | ||
| val importedCode = importedTestCaseName.flatMap { testCaseName => | ||
| val importedTestCaseNames = comments.filter(_.startsWith("--IMPORT ")).map(_.substring(9)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not related to this pr though, I found the misleading name here...
| @@ -1,17 +1,6 @@ | |||
| --SET spark.sql.parser.optionalIntervalPrefix=false | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked if we could turn off the optional prefix with ansi enabled. I personally think keeping this is better because the parser logic is a bit complicated for the combination about ansi + optionalIntervalPrefix...
|
Test build #114241 has finished for PR 26623 at commit
|
|
Test build #114240 has finished for PR 26623 at commit
|
|
Test build #114257 has finished for PR 26623 at commit
|
|
sorry to have this proposal at this stage: can we drop this feature? It looks only useful when we have mysql/hive dialect someday, but I don't think it's going to happen in the near future. Even pgsql dialect is far away from completion. |
|
ok |
What changes were proposed in this pull request?
This pr is to add a new config only for an optional INTERVAL clause. In the master, this feature is enabled when
spark.sql.ansi.enabled=true. This pr proposes to split off the optional interval flag fromspark.sql.ansi.enabled.This comes from the @cloud-fan suggestion: #26584 (comment)
Why are the changes needed?
Actually, an INTERVAL keyword is not optional in the ANSI/SQL standard.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
No.