Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/3178#discussion_r20126013
--- Diff:
sql/hive-thriftserver/v0.13.1/src/main/scala/org/apache/spark/sql/hive/thriftserver/Shim13.scala
---
@@ -123,23 +121,19 @@ private[hive] class SparkExecuteStatementOperation(
case FloatType =>
to += from.getFloat(ordinal)
case DecimalType() =>
- to += from.get(ordinal).asInstanceOf[BigDecimal].bigDecimal
+ to += from.getAs[BigDecimal](ordinal).bigDecimal
case LongType =>
to += from.getLong(ordinal)
case ByteType =>
to += from.getByte(ordinal)
case ShortType =>
to += from.getShort(ordinal)
+ case DateType =>
+ to += from.getAs[Date](ordinal)
case TimestampType =>
- to += from.get(ordinal).asInstanceOf[Timestamp]
- case BinaryType =>
- to += from.get(ordinal).asInstanceOf[String]
- case _: ArrayType =>
- to += from.get(ordinal).asInstanceOf[String]
- case _: StructType =>
- to += from.get(ordinal).asInstanceOf[String]
- case _: MapType =>
- to += from.get(ordinal).asInstanceOf[String]
+ to += from.getAs[Timestamp](ordinal)
+ case StringType | BinaryType | _: ArrayType | _: StructType | _:
MapType =>
+ to += from.getAs[String](ordinal)
--- End diff --
Does this work? Won't this throw a class cast exception for non-string
types?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]