-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Allen Xu <allxu@nvidia.com>
- Loading branch information
Showing
7 changed files
with
48 additions
and
170 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...main/311until320-all/scala/org/apache/spark/sql/types/shims/PartitionValueCastShims.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.apache.spark.sql.types.shims | ||
|
||
import java.time.ZoneId | ||
|
||
import org.apache.spark.sql.types.DataType | ||
|
||
object PartitionValueCastShims { | ||
def isSupportedType(dt: DataType): Boolean = false | ||
|
||
def castTo(desiredType: DataType, value: String, zoneId: ZoneId): Any = { | ||
throw new IllegalArgumentException(s"Unexpected type $desiredType") | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...plugin/src/main/320+/scala/org/apache/spark/sql/types/shims/PartitionValueCastShims.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.apache.spark.sql.types.shims | ||
|
||
import java.time.ZoneId | ||
|
||
import scala.util.Try | ||
|
||
import org.apache.spark.sql.catalyst.catalog.ExternalCatalogUtils.unescapePathName | ||
import org.apache.spark.sql.catalyst.expressions.{Cast, Literal} | ||
import org.apache.spark.sql.types.{AnsiIntervalType, AnyTimestampType, DataType, DateType} | ||
|
||
object PartitionValueCastShims { | ||
def isSupportedType(dt: DataType): Boolean = dt match { | ||
// Timestamp types | ||
case dt if AnyTimestampType.acceptsType(dt) => true | ||
case it: AnsiIntervalType => true | ||
case _ => false | ||
} | ||
|
||
// only for TimestampType TimestampNTZType | ||
def castTo(desiredType: DataType, value: String, zoneId: ZoneId): Any = desiredType match { | ||
case dt if AnyTimestampType.acceptsType(desiredType) => | ||
Try { | ||
Cast(Literal(unescapePathName(value)), dt, Some(zoneId.getId)).eval() | ||
}.getOrElse { | ||
Cast(Cast(Literal(value), DateType, Some(zoneId.getId)), dt).eval() | ||
} | ||
} | ||
} |
22 changes: 0 additions & 22 deletions
22
sql-plugin/src/main/scala/org/apache/spark/sql/errors/rapids/QueryErrorsBase.scala
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
sql-plugin/src/main/scala/org/apache/spark/sql/errors/rapids/QueryExecutionErrors.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 0 additions & 41 deletions
41
sql-plugin/src/main/scala/org/apache/spark/sql/types/rapids/AbstractDataType.scala
This file was deleted.
Oops, something went wrong.
59 changes: 0 additions & 59 deletions
59
sql-plugin/src/main/scala/org/apache/spark/sql/types/rapids/TimestampNTZType.scala
This file was deleted.
Oops, something went wrong.