aboutsummaryrefslogtreecommitdiff
path: root/sql/catalyst/src/main
diff options
context:
space:
mode:
authoreyal farago <eyal farago>2016-08-01 22:43:32 +0800
committerWenchen Fan <wenchen@databricks.com>2016-08-01 22:43:32 +0800
commit338a98d65c8efe0c41f39a8dddeab7040dcda125 (patch)
tree7df24b56bc5f07610dfa99a2c8d3cd9d25eea115 /sql/catalyst/src/main
parentf93ad4fe7c9728c8dd67a8095de3d39fad21d03f (diff)
downloadspark-338a98d65c8efe0c41f39a8dddeab7040dcda125.tar.gz
spark-338a98d65c8efe0c41f39a8dddeab7040dcda125.tar.bz2
spark-338a98d65c8efe0c41f39a8dddeab7040dcda125.zip
[SPARK-16791][SQL] cast struct with timestamp field fails
## What changes were proposed in this pull request? a failing test case + fix to SPARK-16791 (https://issues.apache.org/jira/browse/SPARK-16791) ## How was this patch tested? added a failing test case to CastSuit, then fixed the Cast code and rerun the entire CastSuit Author: eyal farago <eyal farago> Author: Eyal Farago <eyal.farago@actimize.com> Closes #14400 from eyalfa/SPARK-16791_cast_struct_with_timestamp_field_fails.
Diffstat (limited to 'sql/catalyst/src/main')
-rw-r--r--sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
index c452765af2..70fff51956 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
@@ -416,7 +416,7 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression w
}
private[this] def cast(from: DataType, to: DataType): Any => Any = to match {
- case dt if dt == child.dataType => identity[Any]
+ case dt if dt == from => identity[Any]
case StringType => castToString(from)
case BinaryType => castToBinary(from)
case DateType => castToDate(from)