Skip to content

Conversation

@zhulipeng
Copy link
Contributor

@zhulipeng zhulipeng commented Jun 28, 2019

What changes were proposed in this pull request?

The interval conversion behavior is same with the PostgreSQL.

https://github.com/postgres/postgres/blob/REL_12_BETA2/src/test/regress/sql/interval.sql#L180-L203

How was this patch tested?

UT.

@zhulipeng zhulipeng changed the title [SQL]Support 'day to hour', 'day to minute', 'hour to minute' and 'minute to second' [SPARK-28107][SQL]Support 'day to hour', 'day to minute', 'hour to minute' and 'minute to second' Jun 28, 2019
@HyukjinKwon
Copy link
Member

ok to test

@SparkQA
Copy link

SparkQA commented Jun 28, 2019

Test build #107004 has finished for PR 25000 at commit 8c99767.

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

@dongjoon-hyun dongjoon-hyun changed the title [SPARK-28107][SQL]Support 'day to hour', 'day to minute', 'hour to minute' and 'minute to second' [SPARK-28107][SQL] Support 'day to hour', 'day to minute', 'hour to minute' and 'minute to second' Jul 3, 2019
@dongjoon-hyun
Copy link
Member

Retest this please.

seconds = m.group(6) == null ? toLongWithRange("minute", m.group(5), 0, 59)
: toLongWithRange("second", m.group(7), 0, 59);
break;
default:
Copy link
Member

@dongjoon-hyun dongjoon-hyun Jul 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have only two cases, shall we use if ... else instead of switch?

@SparkQA
Copy link

SparkQA commented Jul 3, 2019

Test build #107150 has finished for PR 25000 at commit 8c99767.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@zhulipeng
Copy link
Contributor Author

@HyukjinKwon Thanks for your comments, just did some updates according to your suggestions.

@SparkQA
Copy link

SparkQA commented Jul 3, 2019

Test build #107179 has finished for PR 25000 at commit ed4b3cf.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun
Copy link
Member

Retest this please.

@SparkQA
Copy link

SparkQA commented Jul 3, 2019

Test build #107190 has finished for PR 25000 at commit ed4b3cf.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jul 4, 2019

Test build #107208 has finished for PR 25000 at commit 3edfed6.

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

@SparkQA
Copy link

SparkQA commented Jul 4, 2019

Test build #107216 has finished for PR 25000 at commit fa68a41.

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

@dongjoon-hyun
Copy link
Member

Retest this please.

@SparkQA
Copy link

SparkQA commented Jul 5, 2019

Test build #107266 has finished for PR 25000 at commit fa68a41.

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

*/
public static CalendarInterval fromDayTimeString(String s) throws IllegalArgumentException {
CalendarInterval result = null;
public static CalendarInterval fromDayTimeString(String s) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need throws IllegalArgumentException here.

"899 microseconds")))
checkAnswer(sql("select interval '40:32.99899999' minute to second"),
Row(CalendarInterval.fromString("interval 40 minutes 32 seconds 99 milliseconds " +
"899 microseconds")))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 1203 ~ 1205 are the same with line 1206 ~ 1208.

checkAnswer(sql("select interval '10-9' year to month"),
Row(CalendarInterval.fromString("interval 10 years 9 months")))
checkAnswer(sql("select interval '20 15:40:32.99899999' day to hour"),
Row(CalendarInterval.fromString("interval 2 weeks 6 days 15 hours")))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation?

@zhulipeng zhulipeng changed the title [SPARK-28107][SQL] Support 'day to hour', 'day to minute', 'hour to minute' and 'minute to second' [SPARK-28107][SQL] Support 'day to hour', 'day to minute', ‘day to seconnd’, 'hour to minute', 'hour to second' and 'minute to second' Jul 9, 2019
@zhulipeng zhulipeng changed the title [SPARK-28107][SQL] Support 'day to hour', 'day to minute', ‘day to seconnd’, 'hour to minute', 'hour to second' and 'minute to second' [SPARK-28107][SQL] Support 'day to hour', 'day to minute', ‘day to second’, 'hour to minute', 'hour to second' and 'minute to second' Jul 9, 2019
@SparkQA
Copy link

SparkQA commented Jul 9, 2019

Test build #107393 has finished for PR 25000 at commit c41dccc.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun
Copy link
Member

Retest this please.

@SparkQA
Copy link

SparkQA commented Jul 9, 2019

Test build #107409 has finished for PR 25000 at commit c41dccc.

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

@SparkQA
Copy link

SparkQA commented Jul 10, 2019

Test build #107424 has finished for PR 25000 at commit d68ea26.

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

@dongjoon-hyun dongjoon-hyun changed the title [SPARK-28107][SQL] Support 'day to hour', 'day to minute', ‘day to second’, 'hour to minute', 'hour to second' and 'minute to second' [SPARK-28107][SQL] Support 'DAY TO (HOUR|MINUTE|SECOND)', 'HOUR TO (MINUTE|SECOND)' and 'MINUTE TO SECOND' Jul 10, 2019
@dongjoon-hyun
Copy link
Member

dongjoon-hyun commented Jul 10, 2019

Hi, @lipzhu . I made a PR to your branch. Could you review and merge that?

It's just for minimizing and simplifying the diff of the patch. I checked that all newly added UT passed.

@dongjoon-hyun
Copy link
Member

Thank you for merging.

@SparkQA
Copy link

SparkQA commented Jul 10, 2019

Test build #107436 has finished for PR 25000 at commit bf78d73.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jul 10, 2019

Test build #107438 has finished for PR 25000 at commit ebe917c.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun
Copy link
Member

Retest this please.

@SparkQA
Copy link

SparkQA commented Jul 10, 2019

Test build #107461 has finished for PR 25000 at commit ebe917c.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun
Copy link
Member

Retest this please

@SparkQA
Copy link

SparkQA commented Jul 10, 2019

Test build #107471 has finished for PR 25000 at commit ebe917c.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun
Copy link
Member

The first failure is the following.

  • org.apache.spark.sql.streaming.continuous.ContinuousStressSuite.restarts

The second failure is the following.

  • org.apache.spark.scheduler.TaskSchedulerImplSuite.SPARK-22148 abort timer should clear unschedulableTaskSetToExpiryTime for all TaskSets

Both are irrelevant to this PR.

@dongjoon-hyun
Copy link
Member

Retest this please

@SparkQA
Copy link

SparkQA commented Jul 10, 2019

Test build #107482 has finished for PR 25000 at commit ebe917c.

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

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM. Merged to master.
Thank you so much, @lipzhu !

@zhulipeng
Copy link
Contributor Author

@dongjoon-hyun Thanks for your patient and work on this.

Row(CalendarInterval.fromString("interval 100 milliseconds")))
checkAnswer(sql("select interval '10-9' year to month"),
Row(CalendarInterval.fromString("interval 10 years 9 months")))
checkAnswer(sql("select interval '20 15:40:32.99899999' day to hour"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these test cases are positive ones. Could you add the negative cases too? Do they throw an exception? Exception messages make sense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants