aboutsummaryrefslogtreecommitdiff
path: root/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/statsEstimation/ProjectEstimationSuite.scala
diff options
context:
space:
mode:
Diffstat (limited to 'sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/statsEstimation/ProjectEstimationSuite.scala')
-rw-r--r--sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/statsEstimation/ProjectEstimationSuite.scala21
1 files changed, 11 insertions, 10 deletions
diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/statsEstimation/ProjectEstimationSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/statsEstimation/ProjectEstimationSuite.scala
index f408dc4153..a5c4d22a29 100644
--- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/statsEstimation/ProjectEstimationSuite.scala
+++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/statsEstimation/ProjectEstimationSuite.scala
@@ -21,6 +21,7 @@ import java.sql.{Date, Timestamp}
import org.apache.spark.sql.catalyst.expressions.{Alias, Attribute, AttributeMap, AttributeReference}
import org.apache.spark.sql.catalyst.plans.logical._
+import org.apache.spark.sql.catalyst.util.DateTimeUtils
import org.apache.spark.sql.types._
@@ -62,28 +63,28 @@ class ProjectEstimationSuite extends StatsEstimationTestBase {
}
test("test row size estimation") {
- val dec1 = new java.math.BigDecimal("1.000000000000000000")
- val dec2 = new java.math.BigDecimal("8.000000000000000000")
- val d1 = Date.valueOf("2016-05-08")
- val d2 = Date.valueOf("2016-05-09")
- val t1 = Timestamp.valueOf("2016-05-08 00:00:01")
- val t2 = Timestamp.valueOf("2016-05-09 00:00:02")
+ val dec1 = Decimal("1.000000000000000000")
+ val dec2 = Decimal("8.000000000000000000")
+ val d1 = DateTimeUtils.fromJavaDate(Date.valueOf("2016-05-08"))
+ val d2 = DateTimeUtils.fromJavaDate(Date.valueOf("2016-05-09"))
+ val t1 = DateTimeUtils.fromJavaTimestamp(Timestamp.valueOf("2016-05-08 00:00:01"))
+ val t2 = DateTimeUtils.fromJavaTimestamp(Timestamp.valueOf("2016-05-09 00:00:02"))
val columnInfo: AttributeMap[ColumnStat] = AttributeMap(Seq(
AttributeReference("cbool", BooleanType)() -> ColumnStat(distinctCount = 2,
min = Some(false), max = Some(true), nullCount = 0, avgLen = 1, maxLen = 1),
AttributeReference("cbyte", ByteType)() -> ColumnStat(distinctCount = 2,
- min = Some(1L), max = Some(2L), nullCount = 0, avgLen = 1, maxLen = 1),
+ min = Some(1.toByte), max = Some(2.toByte), nullCount = 0, avgLen = 1, maxLen = 1),
AttributeReference("cshort", ShortType)() -> ColumnStat(distinctCount = 2,
- min = Some(1L), max = Some(3L), nullCount = 0, avgLen = 2, maxLen = 2),
+ min = Some(1.toShort), max = Some(3.toShort), nullCount = 0, avgLen = 2, maxLen = 2),
AttributeReference("cint", IntegerType)() -> ColumnStat(distinctCount = 2,
- min = Some(1L), max = Some(4L), nullCount = 0, avgLen = 4, maxLen = 4),
+ min = Some(1), max = Some(4), nullCount = 0, avgLen = 4, maxLen = 4),
AttributeReference("clong", LongType)() -> ColumnStat(distinctCount = 2,
min = Some(1L), max = Some(5L), nullCount = 0, avgLen = 8, maxLen = 8),
AttributeReference("cdouble", DoubleType)() -> ColumnStat(distinctCount = 2,
min = Some(1.0), max = Some(6.0), nullCount = 0, avgLen = 8, maxLen = 8),
AttributeReference("cfloat", FloatType)() -> ColumnStat(distinctCount = 2,
- min = Some(1.0), max = Some(7.0), nullCount = 0, avgLen = 4, maxLen = 4),
+ min = Some(1.0f), max = Some(7.0f), nullCount = 0, avgLen = 4, maxLen = 4),
AttributeReference("cdecimal", DecimalType.SYSTEM_DEFAULT)() -> ColumnStat(distinctCount = 2,
min = Some(dec1), max = Some(dec2), nullCount = 0, avgLen = 16, maxLen = 16),
AttributeReference("cstring", StringType)() -> ColumnStat(distinctCount = 2,