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-17750][SQL][BACKPORT-2.0] Fix CREATE VIEW with INTERVAL arithmetic #15383

Closed
wants to merge 1 commit into from
Closed

[SPARK-17750][SQL][BACKPORT-2.0] Fix CREATE VIEW with INTERVAL arithmetic #15383

wants to merge 1 commit into from

Conversation

dongjoon-hyun
Copy link
Member

What changes were proposed in this pull request?

Currently, Spark raises RuntimeException when creating a view with timestamp with INTERVAL arithmetic like the following. The root cause is the arithmetic expression, TimeAdd, was transformed into timeadd function as a VIEW definition. This PR fixes the SQL definition of TimeAdd and TimeSub expressions.

scala> sql("CREATE TABLE dates (ts TIMESTAMP)")

scala> sql("CREATE VIEW view1 AS SELECT ts + INTERVAL 1 DAY FROM dates")
java.lang.RuntimeException: Failed to analyze the canonicalized SQL: ...

How was this patch tested?

Pass Jenkins with a new testcase.

@dongjoon-hyun
Copy link
Member Author

Hi, @gatorsmile .
This is a backport of 92b7e57 .

@SparkQA
Copy link

SparkQA commented Oct 6, 2016

Test build #66460 has finished for PR 15383 at commit b8f87ba.

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

@gatorsmile
Copy link
Member

LGTM

asfgit pushed a commit that referenced this pull request Oct 6, 2016
…etic

## What changes were proposed in this pull request?

Currently, Spark raises `RuntimeException` when creating a view with timestamp with INTERVAL arithmetic like the following. The root cause is the arithmetic expression, `TimeAdd`, was transformed into `timeadd` function as a VIEW definition. This PR fixes the SQL definition of `TimeAdd` and `TimeSub` expressions.

```scala
scala> sql("CREATE TABLE dates (ts TIMESTAMP)")

scala> sql("CREATE VIEW view1 AS SELECT ts + INTERVAL 1 DAY FROM dates")
java.lang.RuntimeException: Failed to analyze the canonicalized SQL: ...
```

## How was this patch tested?

Pass Jenkins with a new testcase.

Author: Dongjoon Hyun <dongjoon@apache.org>

Closes #15383 from dongjoon-hyun/SPARK-17750-BACK.
@gatorsmile
Copy link
Member

Merged to 2.0.

@dongjoon-hyun Could you please close it? Thanks!

@dongjoon-hyun
Copy link
Member Author

Thank you so much, @gatorsmile !

abridgett pushed a commit to opensignal/spark that referenced this pull request Oct 10, 2016
…etic

## What changes were proposed in this pull request?

Currently, Spark raises `RuntimeException` when creating a view with timestamp with INTERVAL arithmetic like the following. The root cause is the arithmetic expression, `TimeAdd`, was transformed into `timeadd` function as a VIEW definition. This PR fixes the SQL definition of `TimeAdd` and `TimeSub` expressions.

```scala
scala> sql("CREATE TABLE dates (ts TIMESTAMP)")

scala> sql("CREATE VIEW view1 AS SELECT ts + INTERVAL 1 DAY FROM dates")
java.lang.RuntimeException: Failed to analyze the canonicalized SQL: ...
```

## How was this patch tested?

Pass Jenkins with a new testcase.

Author: Dongjoon Hyun <dongjoon@apache.org>

Closes apache#15383 from dongjoon-hyun/SPARK-17750-BACK.
@dongjoon-hyun dongjoon-hyun deleted the SPARK-17750-BACK branch November 7, 2016 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants