Skip to content

Conversation

@dilipbiswal
Copy link
Contributor

@dilipbiswal dilipbiswal commented Apr 5, 2017

What changes were proposed in this pull request?

Make sure SESSION_LOCAL_TIMEZONE reflects the change in JVM's default timezone setting. Currently several timezone related tests fail as the change to default timezone is not picked up by SQLConf.

How was this patch tested?

Added an unit test in ConfigEntrySuite

def createWithDefaultFunction(defaultFunc: () => T): ConfigEntry[T] = {
val entry =
new ConfigEntryWithDefaultFunction[T](parent.key, defaultFunc, converter,
stringConverter, parent._doc, parent._public)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit

val entry = new XXX(
  param1, param2, ...)

@cloud-fan
Copy link
Contributor

LGTM, we can have a unit test to make sure the default value can change after the conf entry is created, in ConfigEntrySuite

@dilipbiswal
Copy link
Contributor Author

@cloud-fan Sure. I will add the unit test.

@viirya
Copy link
Member

viirya commented Apr 5, 2017

LGTM for the current change. Look forward for the test to add.

@dilipbiswal dilipbiswal changed the title [SPARK-20204][SQL][Followup][WIP] SQLConf should react to change in default timezone settings [SPARK-20204][SQL][Followup] SQLConf should react to change in default timezone settings Apr 5, 2017
assert(conf.get(dConf) === 20.0)
}

test("conf entry: timezone") {
Copy link
Contributor

Choose a reason for hiding this comment

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

we are testing ConfigEntryWithDefaultFunction, not timezone

Copy link
Contributor

Choose a reason for hiding this comment

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

also move this test to the end, it's weird to put this test in the middle of different config types tests.

}

test("conf entry: timezone") {
val tzStart = TimeZone.getDefault().getID()
Copy link
Contributor

Choose a reason for hiding this comment

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

The test can be as simple as:

var data = 0
val conf = new SparkConf()
val iConf = ConfigBuilder(testKey("int")).intConf.createWithDefaultFunction(() => data)
assert(conf.get(iConf) === 0)
data = 2
assert(conf.get(iConf) === 2)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cloud-fan Thank you :-). Its so much simpler. I somehow was trying to use the exact same function that we use in the code.

@SparkQA
Copy link

SparkQA commented Apr 5, 2017

Test build #75537 has finished for PR 17537 at commit 2eb900b.

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

@SparkQA
Copy link

SparkQA commented Apr 5, 2017

Test build #75540 has finished for PR 17537 at commit 6423b51.

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

}
}

/** Creates a [[ConfigEntry]] with a function has a default value */
Copy link
Member

Choose a reason for hiding this comment

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

Creates a [[ConfigEntry]] with a function has a default value
->
Creates a [[ConfigEntry]] with a function to determine the default value


package org.apache.spark.internal.config

import java.util.TimeZone
Copy link
Member

Choose a reason for hiding this comment

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

Remove it?

}



Copy link
Member

Choose a reason for hiding this comment

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

Nit: two more extra spaces

.doc("""The ID of session local timezone, e.g. "GMT", "America/Los_Angeles", etc.""")
.stringConf
.createWithDefault(TimeZone.getDefault().getID())
.createWithDefaultFunction(() => TimeZone.getDefault().getID())
Copy link
Member

Choose a reason for hiding this comment

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

TimeZone.getDefault().getID()
->
TimeZone.getDefault.getID

@gatorsmile
Copy link
Member

LGTM with minor comments.

@SparkQA
Copy link

SparkQA commented Apr 5, 2017

Test build #75548 has finished for PR 17537 at commit 9187cca.

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

@gatorsmile
Copy link
Member

LGTM pending Jenkins

@SparkQA
Copy link

SparkQA commented Apr 6, 2017

Test build #75558 has finished for PR 17537 at commit 1fb23cf.

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

@viirya
Copy link
Member

viirya commented Apr 6, 2017

LGTM

@cloud-fan
Copy link
Contributor

thanks, merging to master!

@asfgit asfgit closed this in 9d68c67 Apr 6, 2017
@dilipbiswal
Copy link
Contributor Author

@viirya @cloud-fan @gatorsmile Thanks a lot.

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.

5 participants