You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by rx...@apache.org on 2015/07/26 19:29:25 UTC
spark git commit: [SPARK-9356][SQL]Remove the internal use of
DecimalType.Unlimited
Repository: spark
Updated Branches:
refs/heads/master 6c400b4f3 -> fb5d43fb2
[SPARK-9356][SQL]Remove the internal use of DecimalType.Unlimited
JIRA: https://issues.apache.org/jira/browse/SPARK-9356
Author: Yijie Shen <he...@gmail.com>
Closes #7671 from yjshen/deprecated_unlimit and squashes the following commits:
c707f56 [Yijie Shen] remove pattern matching in changePrecision
4a1823c [Yijie Shen] remove internal occurrence of Decimal.Unlimited
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/fb5d43fb
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/fb5d43fb
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/fb5d43fb
Branch: refs/heads/master
Commit: fb5d43fb2529d78d55f1fe8d365191c946153640
Parents: 6c400b4
Author: Yijie Shen <he...@gmail.com>
Authored: Sun Jul 26 10:29:22 2015 -0700
Committer: Reynold Xin <rx...@databricks.com>
Committed: Sun Jul 26 10:29:22 2015 -0700
----------------------------------------------------------------------
.../spark/sql/catalyst/expressions/Cast.scala | 22 +++++++-------------
.../expressions/NullFunctionsSuite.scala | 2 +-
.../datasources/PartitioningUtils.scala | 3 +--
3 files changed, 10 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/fb5d43fb/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
----------------------------------------------------------------------
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 e5b83cd..e208262 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
@@ -507,20 +507,14 @@ case class Cast(child: Expression, dataType: DataType)
}
private[this] def changePrecision(d: String, decimalType: DecimalType,
- evPrim: String, evNull: String): String = {
- decimalType match {
- case DecimalType.Unlimited =>
- s"$evPrim = $d;"
- case DecimalType.Fixed(precision, scale) =>
- s"""
- if ($d.changePrecision($precision, $scale)) {
- $evPrim = $d;
- } else {
- $evNull = true;
- }
- """
- }
- }
+ evPrim: String, evNull: String): String =
+ s"""
+ if ($d.changePrecision(${decimalType.precision}, ${decimalType.scale})) {
+ $evPrim = $d;
+ } else {
+ $evNull = true;
+ }
+ """
private[this] def castToDecimalCode(from: DataType, target: DecimalType): CastFunction = {
from match {
http://git-wip-us.apache.org/repos/asf/spark/blob/fb5d43fb/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/NullFunctionsSuite.scala
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/NullFunctionsSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/NullFunctionsSuite.scala
index 9efe44c..ace6c15 100644
--- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/NullFunctionsSuite.scala
+++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/NullFunctionsSuite.scala
@@ -92,7 +92,7 @@ class NullFunctionsSuite extends SparkFunSuite with ExpressionEvalHelper {
val nullOnly = Seq(Literal("x"),
Literal.create(null, DoubleType),
- Literal.create(null, DecimalType.Unlimited),
+ Literal.create(null, DecimalType.USER_DEFAULT),
Literal(Float.MaxValue),
Literal(false))
http://git-wip-us.apache.org/repos/asf/spark/blob/fb5d43fb/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/PartitioningUtils.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/PartitioningUtils.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/PartitioningUtils.scala
index 9d0fa89..66dfcc3 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/PartitioningUtils.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/PartitioningUtils.scala
@@ -179,8 +179,7 @@ private[sql] object PartitioningUtils {
* {{{
* NullType ->
* IntegerType -> LongType ->
- * DoubleType -> DecimalType.Unlimited ->
- * StringType
+ * DoubleType -> StringType
* }}}
*/
private[sql] def resolvePartitions(
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org