aboutsummaryrefslogtreecommitdiff
path: root/sql/catalyst/src
diff options
context:
space:
mode:
authorHuaxin Gao <huaxing@us.ibm.com>2016-12-10 22:41:40 +0800
committerWenchen Fan <wenchen@databricks.com>2016-12-10 22:41:40 +0800
commitc5172568b59b4cf1d3dc7ed8c17a9bea2ea2ab79 (patch)
treebe3605d08b48437dc41b3524ccd9bc351d895c2f /sql/catalyst/src
parent63c9159870ee274c68e24360594ca01d476b9ace (diff)
downloadspark-c5172568b59b4cf1d3dc7ed8c17a9bea2ea2ab79.tar.gz
spark-c5172568b59b4cf1d3dc7ed8c17a9bea2ea2ab79.tar.bz2
spark-c5172568b59b4cf1d3dc7ed8c17a9bea2ea2ab79.zip
[SPARK-17460][SQL] Make sure sizeInBytes in Statistics will not overflow
## What changes were proposed in this pull request? 1. In SparkStrategies.canBroadcast, I will add the check plan.statistics.sizeInBytes >= 0 2. In LocalRelations.statistics, when calculate the statistics, I will change the size to BigInt so it won't overflow. ## How was this patch tested? I will add a test case to make sure the statistics.sizeInBytes won't overflow. Author: Huaxin Gao <huaxing@us.ibm.com> Closes #16175 from huaxingao/spark-17460.
Diffstat (limited to 'sql/catalyst/src')
-rw-r--r--sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/LocalRelation.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/LocalRelation.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/LocalRelation.scala
index 890865d177..91633f5124 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/LocalRelation.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/LocalRelation.scala
@@ -75,7 +75,8 @@ case class LocalRelation(output: Seq[Attribute], data: Seq[InternalRow] = Nil)
}
override lazy val statistics =
- Statistics(sizeInBytes = output.map(_.dataType.defaultSize).sum * data.length)
+ Statistics(sizeInBytes =
+ (output.map(n => BigInt(n.dataType.defaultSize))).sum * data.length)
def toSQL(inlineTableName: String): String = {
require(data.nonEmpty)