Skip to content

[SPARK-23905][SQL] Add UDF weekday - #21009

Closed
yucai wants to merge 2 commits into
apache:masterfrom
yucai:SPARK-23905
Closed

[SPARK-23905][SQL] Add UDF weekday#21009
yucai wants to merge 2 commits into
apache:masterfrom
yucai:SPARK-23905

Conversation

@yucai

@yucaiyucai commented Apr 9, 2018

Copy link
Copy Markdown

What changes were proposed in this pull request?

Add UDF weekday

How was this patch tested?

A new test

@jerryshao

Copy link
Copy Markdown
Contributor

Jenkins, add to whitelist.

@jerryshao

Copy link
Copy Markdown
Contributor

Jenkins, test this please.

@gatorsmilegatorsmile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@SparkQA

Copy link
Copy Markdown

Test build #89081 has finished for PR 21009 at commit 79beb00.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • case class DayOfWeek(child: Expression) extends DayWeek
  • case class WeekDay(child: Expression) extends DayWeek
  • abstract class DayWeek extends UnaryExpression with ImplicitCastInputTypes


override def dataType: DataType = IntegerType

@transient protected lazy val c: Calendar = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: maybe calendar instead of just c.

@transient private lazy val c = {
Calendar.getInstance(DateTimeUtils.getTimeZone("UTC"))
}
case class DayOfWeek(child: Expression) extends DayWeek {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like DayOfWeek is duplicate to WeekDay, do we have plan to deprecate DayOfWeek in maybe 3.0?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

They are not duplicate.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

They are different, see:
WeekDay: 0 = Monday, 1 = Tuesday, … 6 = Sunday
DayOfWeek: 1 = Sunday, 2 = Monday, ..., 7 = Saturday

@yucai

Copy link
Copy Markdown
Author

Jenkins, retest this please

@SparkQA

Copy link
Copy Markdown

Test build #89137 has finished for PR 21009 at commit 2b5db56.

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

@SparkQA

Copy link
Copy Markdown

Test build #89138 has finished for PR 21009 at commit 2b5db56.

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

@yucai

Copy link
Copy Markdown
Author

I did the local testing, all pass.

@yucai

Copy link
Copy Markdown
Author

Jenkins, retest this please

@SparkQA

Copy link
Copy Markdown

Test build #89161 has finished for PR 21009 at commit 2b5db56.

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

@SparkQA

Copy link
Copy Markdown

Test build #89181 has finished for PR 21009 at commit 79beb00.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • case class DayOfWeek(child: Expression) extends DayWeek
  • case class WeekDay(child: Expression) extends DayWeek
  • abstract class DayWeek extends UnaryExpression with ImplicitCastInputTypes

@HyukjinKwonHyukjinKwon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

change itself seems fine.

@SparkQA

Copy link
Copy Markdown

Test build #89229 has finished for PR 21009 at commit 363ff1c.

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

@gatorsmile

Copy link
Copy Markdown
Member

retest this please

@SparkQA

Copy link
Copy Markdown

Test build #89235 has finished for PR 21009 at commit 363ff1c.

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

@SparkQA

Copy link
Copy Markdown

Test build #89242 has finished for PR 21009 at commit 4068289.

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

@gatorsmile

Copy link
Copy Markdown
Member

Thanks! Merged to master.

Sign up for freeto 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.

6 participants

@yucai@jerryshao@SparkQA@gatorsmile@viirya@HyukjinKwon