andygrove commented on code in PR #351:
URL: https://github.com/apache/datafusion-comet/pull/351#discussion_r1584966124
##########
spark/src/test/scala/org/apache/comet/CometCastSuite.scala:
##########
@@ -118,12 +474,68 @@ class CometCastSuite extends CometTestBase with
AdaptiveSparkPlanHelper {
private def generateFloats(): DataFrame = {
val r = new Random(0)
- Range(0, dataSize).map(_ => r.nextFloat()).toDF("a")
+ val values = Seq(
+ Float.MaxValue,
+ Float.MinPositiveValue,
+ Float.MinValue,
+ Float.NaN,
+ Float.PositiveInfinity,
+ Float.NegativeInfinity,
+ 0.0f,
+ -0.0f) ++
+ Range(0, dataSize).map(_ => r.nextFloat())
+ values.toDF("a")
Review Comment:
Thanks. I have pushed an update to add nulls to all generators except for
string. I will address this in a future PR when I change the string generator
to also return a DataFrame.
##########
spark/src/test/scala/org/apache/comet/CometCastSuite.scala:
##########
@@ -118,12 +474,68 @@ class CometCastSuite extends CometTestBase with
AdaptiveSparkPlanHelper {
private def generateFloats(): DataFrame = {
val r = new Random(0)
- Range(0, dataSize).map(_ => r.nextFloat()).toDF("a")
+ val values = Seq(
+ Float.MaxValue,
+ Float.MinPositiveValue,
+ Float.MinValue,
+ Float.NaN,
+ Float.PositiveInfinity,
+ Float.NegativeInfinity,
+ 0.0f,
+ -0.0f) ++
+ Range(0, dataSize).map(_ => r.nextFloat())
+ values.toDF("a")
+ }
+
+ private def generateDoubles(): DataFrame = {
+ val r = new Random(0)
+ val values = Seq(
+ Double.MaxValue,
+ Double.MinPositiveValue,
+ Double.MinValue,
+ Double.NaN,
+ Double.PositiveInfinity,
+ Double.NegativeInfinity,
+ 0.0d,
+ -0.0d) ++
+ Range(0, dataSize).map(_ => r.nextDouble())
+ values.toDF("a")
+ }
+
+ private def generateBools(): DataFrame = {
+ Seq(true, false).toDF("a")
+ }
+
+ private def generateBytes(): DataFrame = {
+ val r = new Random(0)
+ val values = Seq(Byte.MinValue, Byte.MaxValue) ++
+ Range(0, dataSize).map(_ => r.nextInt().toByte)
+ values.toDF("a")
+ }
+
+ private def generateShorts(): DataFrame = {
+ val r = new Random(0)
+ val values = Seq(Short.MinValue, Short.MaxValue) ++
+ Range(0, dataSize).map(_ => r.nextInt().toShort)
+ values.toDF("a")
+ }
+
+ private def generateInts(): DataFrame = {
+ val r = new Random(0)
+ val values = Seq(Int.MinValue, Int.MaxValue) ++
+ Range(0, dataSize).map(_ => r.nextInt())
+ values.toDF("a")
}
private def generateLongs(): DataFrame = {
val r = new Random(0)
- Range(0, dataSize).map(_ => r.nextLong()).toDF("a")
+ val values = Seq(Long.MinValue, Long.MaxValue) ++
+ Range(0, dataSize).map(_ => r.nextLong())
+ values.toDF("a")
+ }
+
+ private def generateDecimals(): DataFrame = {
+ Seq(BigDecimal("123456.789"), BigDecimal("-123456.789"),
BigDecimal("0.0")).toDF("a")
}
private def generateString(r: Random, chars: String, maxLen: Int): String = {
Review Comment:
Added a TODO for this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]