You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "andygrove (via GitHub)" <gi...@apache.org> on 2025/12/13 18:41:09 UTC

[PR] chore: Add shuffle benchmark for deeply nested schemas [datafusion-comet]

andygrove opened a new pull request, #2902:
URL: https://github.com/apache/datafusion-comet/pull/2902

   ## Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #.
   
   ## Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
   -->
   
   ## What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   ## How are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add shuffle benchmark for deeply nested schemas [datafusion-comet]

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #2902:
URL: https://github.com/apache/datafusion-comet/pull/2902#discussion_r2628588850


##########
spark/src/test/scala/org/apache/spark/sql/benchmark/CometShuffleBenchmark.scala:
##########
@@ -490,7 +497,80 @@ object CometShuffleBenchmark extends CometBenchmarkBase {
     }
   }
 
+  def shuffleDeeplyNestedBenchmark(
+      name: String,
+      filename: String,
+      numRows: Int,
+      partitionNum: Int): Unit = {
+    val benchmark =
+      new Benchmark(s"Shuffle with nested schema ($name)", numRows, output = output)
+    val df = spark.read.parquet(filename)
+    withTempTable("deeplyNestedTable") {
+      df.createOrReplaceTempView("deeplyNestedTable")
+      val sql = "select * from deeplyNestedTable"
+
+      benchmark.addCase("Spark") { _ =>
+        spark
+          .sql(sql)
+          .repartition(partitionNum)
+          .noop()
+      }
+
+      benchmark.addCase("Comet (Spark Shuffle)") { _ =>
+        withSQLConf(
+          CometConf.COMET_ENABLED.key -> "true",
+          CometConf.COMET_EXEC_ENABLED.key -> "true",
+          CometConf.COMET_EXEC_SHUFFLE_ENABLED.key -> "false") {
+          spark
+            .sql(sql)
+            .repartition(partitionNum)
+            .noop()
+        }
+      }
+
+      for (shuffle <- Seq("jvm", "native")) {
+        benchmark.addCase(s"Comet ($shuffle Shuffle)") { _ =>
+          withSQLConf(
+            CometConf.COMET_ENABLED.key -> "true",
+            CometConf.COMET_EXEC_ENABLED.key -> "true",
+            CometConf.COMET_EXEC_SHUFFLE_ENABLED.key -> "true",
+            CometConf.COMET_SHUFFLE_MODE.key -> shuffle) {
+            spark
+              .sql(sql)
+              .repartition(partitionNum)
+              .noop()
+          }
+        }
+      }
+
+      benchmark.run()
+    }
+  }
+
   override def runCometBenchmark(mainArgs: Array[String]): Unit = {
+
+    // nested type shuffle
+    val numRows = 1000
+    for (generateArray <- Seq(true, false)) {

Review Comment:
   I added this now



##########
spark/src/main/scala/org/apache/comet/testing/FuzzDataGenerator.scala:
##########
@@ -88,6 +89,68 @@ object FuzzDataGenerator {
     StructType(fields.toSeq)
   }
 
+  def generateNestedSchema(
+      r: Random,
+      numCols: Int,
+      minDepth: Int,
+      maxDepth: Int,
+      options: SchemaGenOptions): StructType = {
+    assert(numCols > 0)
+    assert(minDepth >= 0)
+    assert(maxDepth >= 0)
+    assert(minDepth <= maxDepth)
+    assert(
+      options.generateArray || options.generateStruct || options.generateMap,
+      "cannot generate nested schema if options do not include generating complex types")
+
+    val counter = new AtomicLong
+
+    def generateFieldName() = {
+      s"c_${counter.incrementAndGet()}"
+    }
+
+    def generateArray(depth: Int, name: String) = {
+      val element = genField(r, depth + 1)
+      StructField(name, DataTypes.createArrayType(element.dataType, true))
+    }
+
+    def generateStruct(depth: Int, name: String) = {
+      val fields =
+        Range(1, 2 + r.nextInt(10)).map(_ => genField(r, depth + 1)).toArray
+      StructField(name, DataTypes.createStructType(fields))
+    }
+
+    def generateMap(depth: Int, name: String) = {
+      val keyField = genField(r, depth + 1)
+      val valueField = genField(r, depth + 1)
+      StructField(name, DataTypes.createMapType(keyField.dataType, valueField.dataType))
+    }
+
+    def generatePrimitive(name: String) = {
+      StructField(name, randomChoice(options.primitiveTypes, r))
+    }
+
+    def genField(r: Random, depth: Int): StructField = {
+      val name = generateFieldName()
+      val generators = new ListBuffer[() => StructField]()
+      if (options.generateArray && depth < maxDepth) {
+        generators += (() => generateArray(depth + 1, name))
+      }
+      if (options.generateStruct && depth < maxDepth) {
+        generators += (() => generateStruct(depth + 1, name))
+      }
+      if (options.generateMap && depth < maxDepth) {
+        generators += (() => generateMap(depth, name))

Review Comment:
   fixed



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add shuffle benchmark for deeply nested schemas [datafusion-comet]

Posted by "mbutrovich (via GitHub)" <gi...@apache.org>.
mbutrovich commented on code in PR #2902:
URL: https://github.com/apache/datafusion-comet/pull/2902#discussion_r2631701382


##########
spark/src/main/scala/org/apache/comet/testing/FuzzDataGenerator.scala:
##########
@@ -88,6 +89,68 @@ object FuzzDataGenerator {
     StructType(fields.toSeq)
   }
 
+  def generateNestedSchema(
+      r: Random,
+      numCols: Int,
+      minDepth: Int,
+      maxDepth: Int,
+      options: SchemaGenOptions): StructType = {
+    assert(numCols > 0)
+    assert(minDepth >= 0)
+    assert(maxDepth >= 0)
+    assert(minDepth <= maxDepth)
+    assert(
+      options.generateArray || options.generateStruct || options.generateMap,
+      "cannot generate nested schema if options do not include generating complex types")
+
+    val counter = new AtomicLong

Review Comment:
   Do we anticipate anything concurrent happening here that we need an `AtomicLong`?



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add shuffle benchmark for deeply nested schemas [datafusion-comet]

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on PR #2902:
URL: https://github.com/apache/datafusion-comet/pull/2902#issuecomment-3656763393

   Wondering if nested depth can be configured, I can see now 2 level max, in real world examples typically can be up to 5-6.
   
   More than 5-6 is quite rare, but prob would be still nice to benchmark it


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add shuffle benchmark for deeply nested schemas [datafusion-comet]

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #2902:
URL: https://github.com/apache/datafusion-comet/pull/2902#discussion_r2620208338


##########
dev/benchmarks/comet-tpch.sh:
##########
@@ -41,6 +41,7 @@ $SPARK_HOME/bin/spark-submit \
     --conf spark.plugins=org.apache.spark.CometPlugin \
     --conf spark.shuffle.manager=org.apache.spark.sql.comet.execution.shuffle.CometShuffleManager \
     --conf spark.comet.exec.replaceSortMergeJoin=true \
+    --conf spark.comet.exec.shuffle.writeBufferSize=32000000 \

Review Comment:
   can we also benchmark with shuffle batch size and record batch size?



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add shuffle benchmark for deeply nested schemas [datafusion-comet]

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove merged PR #2902:
URL: https://github.com/apache/datafusion-comet/pull/2902


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add shuffle benchmark for deeply nested schemas [datafusion-comet]

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #2902:
URL: https://github.com/apache/datafusion-comet/pull/2902#discussion_r2623883478


##########
dev/benchmarks/comet-tpch.sh:
##########
@@ -41,6 +41,7 @@ $SPARK_HOME/bin/spark-submit \
     --conf spark.plugins=org.apache.spark.CometPlugin \
     --conf spark.shuffle.manager=org.apache.spark.sql.comet.execution.shuffle.CometShuffleManager \
     --conf spark.comet.exec.replaceSortMergeJoin=true \
+    --conf spark.comet.exec.shuffle.writeBufferSize=32000000 \

Review Comment:
   This was an accidental check in. I have reverted it since it is unrelated to nested schemas.



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add shuffle benchmark for deeply nested schemas [datafusion-comet]

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #2902:
URL: https://github.com/apache/datafusion-comet/pull/2902#discussion_r2631770325


##########
spark/src/main/scala/org/apache/comet/testing/FuzzDataGenerator.scala:
##########
@@ -88,6 +89,68 @@ object FuzzDataGenerator {
     StructType(fields.toSeq)
   }
 
+  def generateNestedSchema(
+      r: Random,
+      numCols: Int,
+      minDepth: Int,
+      maxDepth: Int,
+      options: SchemaGenOptions): StructType = {
+    assert(numCols > 0)
+    assert(minDepth >= 0)
+    assert(maxDepth >= 0)
+    assert(minDepth <= maxDepth)
+    assert(
+      options.generateArray || options.generateStruct || options.generateMap,
+      "cannot generate nested schema if options do not include generating complex types")
+
+    val counter = new AtomicLong

Review Comment:
   I originaly thought that this would just keep the code more concise, but I have removed it now



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add shuffle benchmark for deeply nested schemas [datafusion-comet]

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #2902:
URL: https://github.com/apache/datafusion-comet/pull/2902#discussion_r2624172493


##########
spark/src/main/scala/org/apache/comet/testing/FuzzDataGenerator.scala:
##########
@@ -88,6 +89,68 @@ object FuzzDataGenerator {
     StructType(fields.toSeq)
   }
 
+  def generateNestedSchema(
+      r: Random,
+      numCols: Int,
+      minDepth: Int,
+      maxDepth: Int,
+      options: SchemaGenOptions): StructType = {
+    assert(numCols > 0)
+    assert(minDepth >= 0)
+    assert(maxDepth >= 0)
+    assert(minDepth <= maxDepth)
+    assert(
+      options.generateArray || options.generateStruct || options.generateMap,
+      "cannot generate nested schema if options do not include generating complex types")
+
+    val counter = new AtomicLong
+
+    def generateFieldName() = {
+      s"c_${counter.incrementAndGet()}"
+    }
+
+    def generateArray(depth: Int, name: String) = {
+      val element = genField(r, depth + 1)
+      StructField(name, DataTypes.createArrayType(element.dataType, true))
+    }
+
+    def generateStruct(depth: Int, name: String) = {
+      val fields =
+        Range(1, 2 + r.nextInt(10)).map(_ => genField(r, depth + 1)).toArray
+      StructField(name, DataTypes.createStructType(fields))
+    }
+
+    def generateMap(depth: Int, name: String) = {
+      val keyField = genField(r, depth + 1)
+      val valueField = genField(r, depth + 1)
+      StructField(name, DataTypes.createMapType(keyField.dataType, valueField.dataType))
+    }
+
+    def generatePrimitive(name: String) = {
+      StructField(name, randomChoice(options.primitiveTypes, r))
+    }
+
+    def genField(r: Random, depth: Int): StructField = {
+      val name = generateFieldName()
+      val generators = new ListBuffer[() => StructField]()
+      if (options.generateArray && depth < maxDepth) {
+        generators += (() => generateArray(depth + 1, name))
+      }
+      if (options.generateStruct && depth < maxDepth) {
+        generators += (() => generateStruct(depth + 1, name))
+      }
+      if (options.generateMap && depth < maxDepth) {
+        generators += (() => generateMap(depth, name))

Review Comment:
   just wondering why depth is not + 1 here like for arrays and structs?



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add shuffle benchmark for deeply nested schemas [datafusion-comet]

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #2902:
URL: https://github.com/apache/datafusion-comet/pull/2902#discussion_r2624174728


##########
spark/src/test/scala/org/apache/spark/sql/benchmark/CometShuffleBenchmark.scala:
##########
@@ -490,7 +497,80 @@ object CometShuffleBenchmark extends CometBenchmarkBase {
     }
   }
 
+  def shuffleDeeplyNestedBenchmark(
+      name: String,
+      filename: String,
+      numRows: Int,
+      partitionNum: Int): Unit = {
+    val benchmark =
+      new Benchmark(s"Shuffle with nested schema ($name)", numRows, output = output)
+    val df = spark.read.parquet(filename)
+    withTempTable("deeplyNestedTable") {
+      df.createOrReplaceTempView("deeplyNestedTable")
+      val sql = "select * from deeplyNestedTable"
+
+      benchmark.addCase("Spark") { _ =>
+        spark
+          .sql(sql)
+          .repartition(partitionNum)
+          .noop()
+      }
+
+      benchmark.addCase("Comet (Spark Shuffle)") { _ =>
+        withSQLConf(
+          CometConf.COMET_ENABLED.key -> "true",
+          CometConf.COMET_EXEC_ENABLED.key -> "true",
+          CometConf.COMET_EXEC_SHUFFLE_ENABLED.key -> "false") {
+          spark
+            .sql(sql)
+            .repartition(partitionNum)
+            .noop()
+        }
+      }
+
+      for (shuffle <- Seq("jvm", "native")) {
+        benchmark.addCase(s"Comet ($shuffle Shuffle)") { _ =>
+          withSQLConf(
+            CometConf.COMET_ENABLED.key -> "true",
+            CometConf.COMET_EXEC_ENABLED.key -> "true",
+            CometConf.COMET_EXEC_SHUFFLE_ENABLED.key -> "true",
+            CometConf.COMET_SHUFFLE_MODE.key -> shuffle) {
+            spark
+              .sql(sql)
+              .repartition(partitionNum)
+              .noop()
+          }
+        }
+      }
+
+      benchmark.run()
+    }
+  }
+
   override def runCometBenchmark(mainArgs: Array[String]): Unit = {
+
+    // nested type shuffle
+    val numRows = 1000
+    for (generateArray <- Seq(true, false)) {

Review Comment:
   should map be here as well? 



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add shuffle benchmark for deeply nested schemas [datafusion-comet]

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on PR #2902:
URL: https://github.com/apache/datafusion-comet/pull/2902#issuecomment-3656752836

   maps are not in the scope because Comet dont support grouping by maps yet? 


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add shuffle benchmark for deeply nested schemas [datafusion-comet]

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on PR #2902:
URL: https://github.com/apache/datafusion-comet/pull/2902#issuecomment-3658150654

   > Wondering if nested depth can be configured, I can see now 2 level max, in real world examples typically can be up to 5-6.
   > 
   > More than 5-6 is quite rare, but prob would be still nice to benchmark it
   
   The benchmarks currently run with max depth 2 and 4:
   
   ```
   for (maxDepth <- Seq(2, 4)) {
   ```
   
   However, due to the random schema generation approach, there is no guarantee that the schema will reach these depths. I will see how I can improve 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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add shuffle benchmark for deeply nested schemas [datafusion-comet]

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on PR #2902:
URL: https://github.com/apache/datafusion-comet/pull/2902#issuecomment-3661295855

   > > Wondering if nested depth can be configured, I can see now 2 level max, in real world examples typically can be up to 5-6.
   > > More than 5-6 is quite rare, but prob would be still nice to benchmark it
   > 
   > The benchmarks currently run with max depth 2 and 4:
   > 
   > ```
   > for (maxDepth <- Seq(2, 4)) {
   > ```
   > 
   > However, due to the random schema generation approach, there is no guarantee that the schema will reach these depths. I will see how I can improve this.
   
   @comphead I have now added `minDepth` as well.


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add shuffle benchmark for deeply nested schemas [datafusion-comet]

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on PR #2902:
URL: https://github.com/apache/datafusion-comet/pull/2902#issuecomment-3661294327

   > maps are not in the scope because Comet dont support grouping by maps yet?
   
   I was being lazy. I have added map support now.


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add shuffle benchmark for deeply nested schemas [datafusion-comet]

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on PR #2902:
URL: https://github.com/apache/datafusion-comet/pull/2902#issuecomment-3656495690

   @comphead the addition to the fuzz generator for generating deeply nested schema could be useful to try and reproduce the reported issue about shuffle metrics being inaccurate


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add shuffle benchmark for deeply nested schemas [datafusion-comet]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #2902:
URL: https://github.com/apache/datafusion-comet/pull/2902#issuecomment-3649750337

   ## [Codecov](https://app.codecov.io/gh/apache/datafusion-comet/pull/2902?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `0%` with `19 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 10.04%. Comparing base ([`f09f8af`](https://app.codecov.io/gh/apache/datafusion-comet/commit/f09f8af64c6599255e116a376f4f008f2fd63b43?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`9f2154e`](https://app.codecov.io/gh/apache/datafusion-comet/commit/9f2154e241e35d042191b15871411302e162cb31?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 760 commits behind head on main.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/datafusion-comet/pull/2902?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...a/org/apache/comet/testing/FuzzDataGenerator.scala](https://app.codecov.io/gh/apache/datafusion-comet/pull/2902?src=pr&el=tree&filepath=spark%2Fsrc%2Fmain%2Fscala%2Forg%2Fapache%2Fcomet%2Ftesting%2FFuzzDataGenerator.scala&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3Bhcmsvc3JjL21haW4vc2NhbGEvb3JnL2FwYWNoZS9jb21ldC90ZXN0aW5nL0Z1enpEYXRhR2VuZXJhdG9yLnNjYWxh) | 0.00% | [19 Missing :warning: ](https://app.codecov.io/gh/apache/datafusion-comet/pull/2902?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@              Coverage Diff              @@
   ##               main    #2902       +/-   ##
   =============================================
   - Coverage     56.12%   10.04%   -46.09%     
   + Complexity      976      234      -742     
   =============================================
     Files           119      167       +48     
     Lines         11743    15340     +3597     
     Branches       2251     2528      +277     
   =============================================
   - Hits           6591     1541     -5050     
   - Misses         4012    13623     +9611     
   + Partials       1140      176      -964     
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/datafusion-comet/pull/2902?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   </details>


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add shuffle benchmark for deeply nested schemas [datafusion-comet]

Posted by "wForget (via GitHub)" <gi...@apache.org>.
wForget commented on code in PR #2902:
URL: https://github.com/apache/datafusion-comet/pull/2902#discussion_r2617652426


##########
spark/src/test/scala/org/apache/spark/sql/benchmark/CometShuffleBenchmark.scala:
##########
@@ -35,6 +41,9 @@ import org.apache.comet.CometSparkSessionExtensions
  * "spark/benchmarks/CometShuffleBenchmark-**results.txt".
  */
 object CometShuffleBenchmark extends CometBenchmarkBase {
+
+  new AtomicLong()

Review Comment:
   Is this useless code?



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add shuffle benchmark for deeply nested schemas [datafusion-comet]

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #2902:
URL: https://github.com/apache/datafusion-comet/pull/2902#discussion_r2624176652


##########
spark/src/main/scala/org/apache/comet/testing/FuzzDataGenerator.scala:
##########
@@ -88,6 +89,68 @@ object FuzzDataGenerator {
     StructType(fields.toSeq)
   }
 
+  def generateNestedSchema(
+      r: Random,
+      numCols: Int,
+      minDepth: Int,
+      maxDepth: Int,
+      options: SchemaGenOptions): StructType = {
+    assert(numCols > 0)
+    assert(minDepth >= 0)
+    assert(maxDepth >= 0)
+    assert(minDepth <= maxDepth)
+    assert(
+      options.generateArray || options.generateStruct || options.generateMap,
+      "cannot generate nested schema if options do not include generating complex types")
+
+    val counter = new AtomicLong
+
+    def generateFieldName() = {
+      s"c_${counter.incrementAndGet()}"
+    }
+
+    def generateArray(depth: Int, name: String) = {
+      val element = genField(r, depth + 1)
+      StructField(name, DataTypes.createArrayType(element.dataType, true))
+    }
+
+    def generateStruct(depth: Int, name: String) = {
+      val fields =
+        Range(1, 2 + r.nextInt(10)).map(_ => genField(r, depth + 1)).toArray
+      StructField(name, DataTypes.createStructType(fields))
+    }
+
+    def generateMap(depth: Int, name: String) = {
+      val keyField = genField(r, depth + 1)
+      val valueField = genField(r, depth + 1)
+      StructField(name, DataTypes.createMapType(keyField.dataType, valueField.dataType))
+    }
+
+    def generatePrimitive(name: String) = {
+      StructField(name, randomChoice(options.primitiveTypes, r))
+    }
+
+    def genField(r: Random, depth: Int): StructField = {
+      val name = generateFieldName()
+      val generators = new ListBuffer[() => StructField]()
+      if (options.generateArray && depth < maxDepth) {
+        generators += (() => generateArray(depth + 1, name))
+      }
+      if (options.generateStruct && depth < maxDepth) {
+        generators += (() => generateStruct(depth + 1, name))
+      }
+      if (options.generateMap && depth < maxDepth) {
+        generators += (() => generateMap(depth, name))

Review Comment:
   Thanks, that's incorrect ... I will fix



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org