HyukjinKwon commented on a change in pull request #30476:
URL: https://github.com/apache/spark/pull/30476#discussion_r529105230
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/SubExprEliminationBenchmark.scala
##########
@@ -108,11 +110,81 @@ object SubExprEliminationBenchmark extends
SqlBasedBenchmark {
}
}
+ def withFilter(rowsNum: Int, numIters: Int): Unit = {
+ val benchmark = new Benchmark("from_json as subExpr in Filter", rowsNum,
output = output)
+
+ withTempPath { path =>
+ prepareDataInfo(benchmark)
+ val numCols = 1000
+ val schema = writeWideRow(path.getAbsolutePath, rowsNum, numCols)
+
+ val predicate = (0 until numCols).map { idx =>
+ (from_json('value, schema).getField(s"col$idx") >=
Literal(100000)).expr
+ }.asInstanceOf[Seq[Expression]].reduce(Or)
+
+ // We only benchmark subexpression performance under
codegen/non-codegen, so disabling
+ // json optimization.
+ benchmark.addCase("subexpressionElimination off, codegen on", numIters)
{ _ =>
+ withSQLConf(
+ SQLConf.SUBEXPRESSION_ELIMINATION_ENABLED.key -> "false",
+ SQLConf.WHOLESTAGE_CODEGEN_ENABLED.key -> "true",
+ SQLConf.CODEGEN_FACTORY_MODE.key -> "CODEGEN_ONLY",
+ SQLConf.JSON_EXPRESSION_OPTIMIZATION.key -> "false") {
+ val df = spark.read
+ .text(path.getAbsolutePath)
+ .where(Column(predicate))
+ df.collect()
Review comment:
Can we use `write.format("noop").save()`?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]