You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by li...@apache.org on 2015/03/04 13:24:40 UTC
spark git commit: [SPARK-6134][SQL] Fix wrong datatype for casting
FloatType and default LongType value in defaultPrimitive
Repository: spark
Updated Branches:
refs/heads/master 76b472f12 -> aef8a84e4
[SPARK-6134][SQL] Fix wrong datatype for casting FloatType and default LongType value in defaultPrimitive
In `CodeGenerator`, the casting on `FloatType` should use `FloatType` instead of `IntegerType`.
Besides, `defaultPrimitive` for `LongType` should be `-1L` instead of `1L`.
Author: Liang-Chi Hsieh <vi...@gmail.com>
Closes #4870 from viirya/codegen_type and squashes the following commits:
76311dd [Liang-Chi Hsieh] Fix wrong datatype for casting on FloatType. Fix the wrong value for LongType in defaultPrimitive.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/aef8a84e
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/aef8a84e
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/aef8a84e
Branch: refs/heads/master
Commit: aef8a84e42351419a67d56abaf1ee75a05eb11ea
Parents: 76b472f
Author: Liang-Chi Hsieh <vi...@gmail.com>
Authored: Wed Mar 4 20:23:43 2015 +0800
Committer: Cheng Lian <li...@databricks.com>
Committed: Wed Mar 4 20:23:43 2015 +0800
----------------------------------------------------------------------
.../spark/sql/catalyst/expressions/codegen/CodeGenerator.scala | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/aef8a84e/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
index c347780..e48b8cd 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
@@ -259,7 +259,7 @@ abstract class CodeGenerator[InType <: AnyRef, OutType <: AnyRef] extends Loggin
child.castOrNull(c => q"$c.toDouble", DoubleType)
case Cast(child @ NumericType(), FloatType) =>
- child.castOrNull(c => q"$c.toFloat", IntegerType)
+ child.castOrNull(c => q"$c.toFloat", FloatType)
// Special handling required for timestamps in hive test cases since the toString function
// does not match the expected output.
@@ -626,7 +626,7 @@ abstract class CodeGenerator[InType <: AnyRef, OutType <: AnyRef] extends Loggin
case FloatType => ru.Literal(Constant(-1.0.toFloat))
case StringType => ru.Literal(Constant("<uninit>"))
case ShortType => ru.Literal(Constant(-1.toShort))
- case LongType => ru.Literal(Constant(1L))
+ case LongType => ru.Literal(Constant(-1L))
case ByteType => ru.Literal(Constant(-1.toByte))
case DoubleType => ru.Literal(Constant(-1.toDouble))
case DecimalType() => q"org.apache.spark.sql.types.Decimal(-1)"
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org