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-35037][SQL] Recognize sign before the interval string in literals #32134

Closed
wants to merge 1 commit into from

Conversation

MaxGekk
Copy link
Member

@MaxGekk MaxGekk commented Apr 12, 2021

What changes were proposed in this pull request?

  1. Extend SQL syntax rules to support a sign before the interval strings of ANSI year-month and day-time intervals.
  2. Recognize - in AstBuilder and negate parsed intervals.

Why are the changes needed?

To conform to the SQL standard which allows a sign before the string interval, see "5.3 <literal>":

<interval literal> ::=
  INTERVAL [ <sign> ] <interval string> <interval qualifier>
<interval string> ::=
  <quote> <unquoted interval string> <quote>
<unquoted interval string> ::=
  [ <sign> ] { <year-month literal> | <day-time literal> }
<sign> ::=
    <plus sign>
  | <minus sign>

Does this PR introduce any user-facing change?

Should not because it just extends supported intervals syntax.

How was this patch tested?

By running new tests in interval.sql:

$ build/sbt "sql/testOnly *SQLQueryTestSuite -- -z interval.sql"

@SparkQA
Copy link

SparkQA commented Apr 12, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/41819/

@SparkQA
Copy link

SparkQA commented Apr 12, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/41819/

@github-actions github-actions bot added the SQL label Apr 12, 2021
@SparkQA
Copy link

SparkQA commented Apr 13, 2021

Test build #137239 has finished for PR 32134 at commit 9b44a38.

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

@MaxGekk
Copy link
Member Author

MaxGekk commented Apr 13, 2021

The GA "Build and test / Scala 2.13 build with SBT (pull_request)" failed but I checked scala 2.13 locally:

$ ./dev/change-scala-version.sh 2.13
$ ./build/sbt -Pscala-2.13 compile
[success] Total time: 145 s (02:25), completed Apr 13, 2021 8:50:50 AM

@MaxGekk
Copy link
Member Author

MaxGekk commented Apr 13, 2021

Merging to master. Thank you @srowen for review.

@MaxGekk MaxGekk closed this in 26f312e Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants