Skip to content

Commit

Permalink
fix for scala 2.13
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrove committed May 26, 2024
1 parent 2b5ad2e commit a19fb4d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion fuzz-testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ under the License.
<dependency>
<groupId>org.rogach</groupId>
<artifactId>scallop_${scala.binary.version}</artifactId>
<version>3.5.1</version>
<version>5.1.0</version>
</dependency>
</dependencies>

Expand Down
39 changes: 22 additions & 17 deletions fuzz-testing/src/main/scala/org/apache/comet/fuzz/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,22 @@ import org.rogach.scallop.ScallopOption
import org.apache.spark.sql.SparkSession

class Conf(arguments: Seq[String]) extends ScallopConf(arguments) {
val generateData: generateData = new generateData
class generateData extends Subcommand("data") {
object generateData extends Subcommand("data") {
val numFiles: ScallopOption[Int] = opt[Int](required = true)
val numRows: ScallopOption[Int] = opt[Int](required = true)
val numColumns: ScallopOption[Int] = opt[Int](required = true)
}
val generateQueries: generateQueries = new generateQueries
class generateQueries extends Subcommand("queries") {
addSubcommand(generateData)
object generateQueries extends Subcommand("queries") {
val numFiles: ScallopOption[Int] = opt[Int](required = false)
val numQueries: ScallopOption[Int] = opt[Int](required = true)
}
val runQueries: runQueries = new runQueries
class runQueries extends Subcommand("run") {
addSubcommand(generateQueries)
object runQueries extends Subcommand("run") {
val filename: ScallopOption[String] = opt[String](required = true)
val numFiles: ScallopOption[Int] = opt[Int](required = false)
val showMatchingResults: ScallopOption[Boolean] = opt[Boolean](required = false)
}
addSubcommand(generateData)
addSubcommand(generateQueries)
addSubcommand(runQueries)
verify()
}
Expand All @@ -60,19 +57,27 @@ object Main {
def main(args: Array[String]): Unit = {
val r = new Random(42)

val conf = new Conf(args)
val conf = new Conf(args.toIndexedSeq)
conf.subcommand match {
case Some(opt @ conf.generateData) =>
case Some(conf.generateData) =>
DataGen.generateRandomFiles(
r,
spark,
numFiles = opt.numFiles(),
numRows = opt.numRows(),
numColumns = opt.numColumns())
case Some(opt @ conf.generateQueries) =>
QueryGen.generateRandomQueries(r, spark, numFiles = opt.numFiles(), opt.numQueries())
case Some(opt @ conf.runQueries) =>
QueryRunner.runQueries(spark, opt.numFiles(), opt.filename(), opt.showMatchingResults())
numFiles = conf.generateData.numFiles(),
numRows = conf.generateData.numRows(),
numColumns = conf.generateData.numColumns())
case Some(conf.generateQueries) =>
QueryGen.generateRandomQueries(
r,
spark,
numFiles = conf.generateQueries.numFiles(),
conf.generateQueries.numQueries())
case Some(conf.runQueries) =>
QueryRunner.runQueries(
spark,
conf.runQueries.numFiles(),
conf.runQueries.filename(),
conf.runQueries.showMatchingResults())
case _ =>
// scalastyle:off println
println("Invalid subcommand")
Expand Down

0 comments on commit a19fb4d

Please sign in to comment.