Skip to content

Commit

Permalink
remove array type match case, which should already been handled in Ra…
Browse files Browse the repository at this point in the history
…ndomDataGenerator.forType
  • Loading branch information
advancedxy committed May 21, 2024
1 parent 1e9e9ee commit 03fc030
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions spark/src/test/scala/org/apache/comet/DataGenerator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -109,25 +109,8 @@ class DataGenerator(r: Random) {
val fields = mutable.ArrayBuffer.empty[Any]
schema.fields.foreach { f =>
f.dataType match {
case ArrayType(childType, nullable) =>
val data = if (f.nullable && r.nextFloat() <= PROBABILITY_OF_NULL) {
null
} else {
val arr = mutable.ArrayBuffer.empty[Any]
val n = 1 // rand.nextInt(10)
var i = 0
val generator = RandomDataGenerator.forType(childType, nullable, r)
assert(generator.isDefined, "Unsupported type")
val gen = generator.get
while (i < n) {
arr += gen()
i += 1
}
arr.toSeq
}
fields += data
case StructType(children) =>
fields += generateRow(StructType(children))
fields += generateRow(StructType(children), stringGen)
case StringType if stringGen.isDefined =>
val gen = stringGen.get
val data = if (f.nullable && r.nextFloat() <= PROBABILITY_OF_NULL) {
Expand Down

0 comments on commit 03fc030

Please sign in to comment.