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

Remove get call on timeZoneId #1906

Merged
merged 4 commits into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,9 @@ class Spark300Shims extends SparkShims {
}
case _ =>
}
if (ZoneId.of(a.timeZoneId.get).normalized() != GpuOverrides.UTC_TIMEZONE_ID) {
willNotWorkOnGpu("Only UTC zone id is supported")
a.timeZoneId.foreach {
case zoneId if ZoneId.of(zoneId).normalized() != GpuOverrides.UTC_TIMEZONE_ID =>
willNotWorkOnGpu(s"Only UTC zone id is supported. Actual zone id: $zoneId")
jlowe marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1322,8 +1322,9 @@ object GpuOverrides {
willNotWorkOnGpu("interval months isn't supported")
}
}
if (ZoneId.of(a.timeZoneId.get).normalized() != GpuOverrides.UTC_TIMEZONE_ID) {
willNotWorkOnGpu("Only UTC zone id is supported")
a.timeZoneId.foreach {
case zoneId if ZoneId.of(zoneId).normalized() != GpuOverrides.UTC_TIMEZONE_ID =>
willNotWorkOnGpu(s"Only UTC zone id is supported. Actual zone id: $zoneId")
}
}

Expand Down Expand Up @@ -1399,8 +1400,9 @@ object GpuOverrides {
TypeSig.TIMESTAMP, TypeSig.TIMESTAMP),
(a, conf, p, r) => new UnaryExprMeta[Hour](a, conf, p, r) {
override def tagExprForGpu(): Unit = {
if (ZoneId.of(a.timeZoneId.get).normalized() != UTC_TIMEZONE_ID) {
willNotWorkOnGpu("Only UTC zone id is supported")
a.timeZoneId.foreach {
case zoneId if ZoneId.of(zoneId).normalized() != GpuOverrides.UTC_TIMEZONE_ID =>
willNotWorkOnGpu(s"Only UTC zone id is supported. Actual zone id: $zoneId")
}
}

Expand All @@ -1412,8 +1414,9 @@ object GpuOverrides {
TypeSig.TIMESTAMP, TypeSig.TIMESTAMP),
(a, conf, p, r) => new UnaryExprMeta[Minute](a, conf, p, r) {
override def tagExprForGpu(): Unit = {
if (ZoneId.of(a.timeZoneId.get).normalized() != UTC_TIMEZONE_ID) {
willNotWorkOnGpu("Only UTC zone id is supported")
a.timeZoneId.foreach {
case zoneId if ZoneId.of(zoneId).normalized() != GpuOverrides.UTC_TIMEZONE_ID =>
willNotWorkOnGpu(s"Only UTC zone id is supported. Actual zone id: $zoneId")
}
}

Expand All @@ -1426,9 +1429,10 @@ object GpuOverrides {
TypeSig.TIMESTAMP, TypeSig.TIMESTAMP),
(a, conf, p, r) => new UnaryExprMeta[Second](a, conf, p, r) {
override def tagExprForGpu(): Unit = {
if (ZoneId.of(a.timeZoneId.get).normalized() != UTC_TIMEZONE_ID) {
willNotWorkOnGpu("Only UTC zone id is supported")
}
a.timeZoneId.foreach {
case zoneId if ZoneId.of(zoneId).normalized() != GpuOverrides.UTC_TIMEZONE_ID =>
willNotWorkOnGpu(s"Only UTC zone id is supported. Actual zone id: $zoneId")
}
}

override def convertToGpu(expr: Expression): GpuExpression =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,9 @@ abstract class UnixTimeExprMeta[A <: BinaryExpression with TimeZoneAwareExpressi
var sparkFormat: String = _
var strfFormat: String = _
override def tagExprForGpu(): Unit = {
if (ZoneId.of(expr.timeZoneId.get).normalized() != GpuOverrides.UTC_TIMEZONE_ID) {
willNotWorkOnGpu("Only UTC zone id is supported")
expr.timeZoneId.foreach {
case zoneId if ZoneId.of(zoneId).normalized() != GpuOverrides.UTC_TIMEZONE_ID =>
willNotWorkOnGpu(s"Only UTC zone id is supported. Actual zone id: $zoneId")
}
// Date and Timestamp work too
if (expr.right.dataType == StringType) {
Expand Down