From 61576a471ba17dbde40fd0e48fd80d51d2d2ea7d Mon Sep 17 00:00:00 2001 From: zml1206 Date: Thu, 9 Oct 2025 17:43:17 +0800 Subject: [PATCH] [MINOR] Optimize code style for test of backend-velox --- .../execution/DynamicOffHeapSizingSuite.scala | 1 - .../gluten/execution/FallbackSuite.scala | 2 +- .../GlutenSQLCollectTailExecSuite.scala | 1 - .../gluten/execution/MiscOperatorSuite.scala | 16 +- .../VeloxAggregateFunctionsSuite.scala | 11 +- .../gluten/execution/VeloxHashJoinSuite.scala | 4 +- .../gluten/execution/VeloxScanSuite.scala | 6 +- .../enumerated/planner/VeloxRasSuite.scala | 2 +- .../JsonFunctionsValidateSuite.scala | 170 +++++++++--------- .../ScalarFunctionsValidateSuite.scala | 14 +- .../memory/GlobalOffHeapMemorySuite.scala | 4 +- .../sql/execution/VeloxExpandSuite.scala | 6 +- .../joins/GlutenExistenceJoinSuite.scala | 2 +- .../UnsafeColumnarBuildSideRelationTest.scala | 8 +- 14 files changed, 121 insertions(+), 126 deletions(-) diff --git a/backends-velox/src/test/scala/org/apache/gluten/execution/DynamicOffHeapSizingSuite.scala b/backends-velox/src/test/scala/org/apache/gluten/execution/DynamicOffHeapSizingSuite.scala index 50485a3d574f..aa71c867b22a 100644 --- a/backends-velox/src/test/scala/org/apache/gluten/execution/DynamicOffHeapSizingSuite.scala +++ b/backends-velox/src/test/scala/org/apache/gluten/execution/DynamicOffHeapSizingSuite.scala @@ -53,7 +53,6 @@ class DynamicOffHeapSizingSuite extends VeloxWholeStageTransformerSuite { """.stripMargin var totalMemory = Runtime.getRuntime().totalMemory() var freeMemory = Runtime.getRuntime().freeMemory() - val maxMemory = Runtime.getRuntime().maxMemory() // Ensure that the JVM memory is not too small to trigger dynamic off-heap sizing. while (!DynamicOffHeapSizingMemoryTarget.canShrinkJVMMemory(totalMemory, freeMemory)) { withSQLConf(("spark.gluten.enabled", "false")) { diff --git a/backends-velox/src/test/scala/org/apache/gluten/execution/FallbackSuite.scala b/backends-velox/src/test/scala/org/apache/gluten/execution/FallbackSuite.scala index 8efbb18ef298..83958537f1c7 100644 --- a/backends-velox/src/test/scala/org/apache/gluten/execution/FallbackSuite.scala +++ b/backends-velox/src/test/scala/org/apache/gluten/execution/FallbackSuite.scala @@ -123,7 +123,7 @@ class FallbackSuite extends VeloxWholeStageTransformerSuite with AdaptiveSparkPl case _: BroadcastHashJoinExecTransformerBase => true case _ => false } - assert(!columnarBhj.isDefined) + assert(columnarBhj.isEmpty) val vanillaBhj = find(plan) { case _: BroadcastHashJoinExec => true diff --git a/backends-velox/src/test/scala/org/apache/gluten/execution/GlutenSQLCollectTailExecSuite.scala b/backends-velox/src/test/scala/org/apache/gluten/execution/GlutenSQLCollectTailExecSuite.scala index d92fc4eac380..502093da0d74 100644 --- a/backends-velox/src/test/scala/org/apache/gluten/execution/GlutenSQLCollectTailExecSuite.scala +++ b/backends-velox/src/test/scala/org/apache/gluten/execution/GlutenSQLCollectTailExecSuite.scala @@ -98,7 +98,6 @@ class GlutenSQLCollectTailExecSuite extends WholeStageTransformerSuite { test("ColumnarCollectTailExec - with filter") { val df = spark.range(0, 10000, 1).toDF("id").filter("id % 2 == 0").orderBy("id") - val evenCount = 5000 val expected = (9990L to 9998L by 2).map(Row(_)).takeRight(5) verifyTailExec(df, expected, tailCount = 5) } diff --git a/backends-velox/src/test/scala/org/apache/gluten/execution/MiscOperatorSuite.scala b/backends-velox/src/test/scala/org/apache/gluten/execution/MiscOperatorSuite.scala index 5403b786b3ed..d8b3929ded14 100644 --- a/backends-velox/src/test/scala/org/apache/gluten/execution/MiscOperatorSuite.scala +++ b/backends-velox/src/test/scala/org/apache/gluten/execution/MiscOperatorSuite.scala @@ -332,7 +332,7 @@ class MiscOperatorSuite extends VeloxWholeStageTransformerSuite with AdaptiveSpa } test("group sets") { - val result = runQueryAndCompare( + runQueryAndCompare( "select l_orderkey, l_partkey, sum(l_suppkey) from lineitem " + "where l_orderkey < 3 group by ROLLUP(l_orderkey, l_partkey) " + "order by l_orderkey, l_partkey ") { _ => } @@ -583,13 +583,13 @@ class MiscOperatorSuite extends VeloxWholeStageTransformerSuite with AdaptiveSpa } test("union two tables") { - val df = runQueryAndCompare(""" - |select count(orderkey) from ( - | select l_orderkey as orderkey from lineitem - | union - | select o_orderkey as orderkey from orders - |); - |""".stripMargin) { + runQueryAndCompare(""" + |select count(orderkey) from ( + | select l_orderkey as orderkey from lineitem + | union + | select o_orderkey as orderkey from orders + |); + |""".stripMargin) { df => { getExecutedPlan(df).exists(plan => plan.find(_.isInstanceOf[ColumnarUnionExec]).isDefined) diff --git a/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxAggregateFunctionsSuite.scala b/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxAggregateFunctionsSuite.scala index b5ebcf1785ec..f27039292f73 100644 --- a/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxAggregateFunctionsSuite.scala +++ b/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxAggregateFunctionsSuite.scala @@ -53,10 +53,9 @@ abstract class VeloxAggregateFunctionsSuite extends VeloxWholeStageTransformerSu } test("count") { - val df = - runQueryAndCompare("select count(*) from lineitem where l_partkey in (1552, 674, 1062)") { - checkGlutenOperatorMatch[HashAggregateExecTransformer] - } + runQueryAndCompare("select count(*) from lineitem where l_partkey in (1552, 674, 1062)") { + checkGlutenOperatorMatch[HashAggregateExecTransformer] + } runQueryAndCompare("select count(l_quantity), count(distinct l_partkey) from lineitem") { df => { @@ -70,7 +69,7 @@ abstract class VeloxAggregateFunctionsSuite extends VeloxWholeStageTransformerSu } test("avg") { - val df = runQueryAndCompare("select avg(l_partkey) from lineitem where l_partkey < 1000") { + runQueryAndCompare("select avg(l_partkey) from lineitem where l_partkey < 1000") { checkGlutenOperatorMatch[HashAggregateExecTransformer] } runQueryAndCompare("select avg(l_quantity), count(distinct l_partkey) from lineitem") { @@ -215,7 +214,7 @@ abstract class VeloxAggregateFunctionsSuite extends VeloxWholeStageTransformerSu } test("group sets") { - val result = runQueryAndCompare( + runQueryAndCompare( "select l_orderkey, l_partkey, sum(l_suppkey) from lineitem " + "where l_orderkey < 3 group by ROLLUP(l_orderkey, l_partkey) " + "order by l_orderkey, l_partkey ") { _ => } diff --git a/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxHashJoinSuite.scala b/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxHashJoinSuite.scala index f242b24f3451..fe2ae6ba71f3 100644 --- a/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxHashJoinSuite.scala +++ b/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxHashJoinSuite.scala @@ -159,8 +159,8 @@ class VeloxHashJoinSuite extends VeloxWholeStageTransformerSuite { Seq("true", "false").foreach( enabledOffheapBroadcast => withSQLConf( - (GlutenConfig.GLUTEN_COLUMNAR_TO_ROW_MEM_THRESHOLD.key -> "16"), - (VeloxConfig.VELOX_BROADCAST_BUILD_RELATION_USE_OFFHEAP.key -> enabledOffheapBroadcast)) { + GlutenConfig.GLUTEN_COLUMNAR_TO_ROW_MEM_THRESHOLD.key -> "16", + VeloxConfig.VELOX_BROADCAST_BUILD_RELATION_USE_OFFHEAP.key -> enabledOffheapBroadcast) { withTable("t1", "t2") { spark.sql(""" |CREATE TABLE t1 USING PARQUET diff --git a/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxScanSuite.scala b/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxScanSuite.scala index f750ff65bd25..5caf3df83202 100644 --- a/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxScanSuite.scala +++ b/backends-velox/src/test/scala/org/apache/gluten/execution/VeloxScanSuite.scala @@ -94,9 +94,9 @@ class VeloxScanSuite extends VeloxWholeStageTransformerSuite { val plan = df.queryExecution.executedPlan val fileScan = collect(plan) { case s: FileSourceScanExecTransformer => s } assert(fileScan.size == 1) - val rootPaths = fileScan(0).getRootPathsInternal + val rootPaths = fileScan.head.getRootPathsInternal assert(rootPaths.length == 1) - assert(rootPaths(0).startsWith("file:/")) + assert(rootPaths.head.startsWith("file:/")) assert( VeloxFileSystemValidationJniWrapper.allSupportedByRegisteredFileSystems( rootPaths.toArray)) @@ -107,7 +107,7 @@ class VeloxScanSuite extends VeloxWholeStageTransformerSuite { VeloxBackendSettings.distinctRootPaths( Seq("file:/test_path/", "test://test/s", "test://test1/s")) assert(filteredRootPath.length == 1) - assert(filteredRootPath(0).startsWith("test://")) + assert(filteredRootPath.head.startsWith("test://")) assert( VeloxFileSystemValidationJniWrapper.allSupportedByRegisteredFileSystems( Array("file:/test_path/"))) diff --git a/backends-velox/src/test/scala/org/apache/gluten/extension/columnar/enumerated/planner/VeloxRasSuite.scala b/backends-velox/src/test/scala/org/apache/gluten/extension/columnar/enumerated/planner/VeloxRasSuite.scala index 8db5c0b1b9b2..6f31740ca3b0 100644 --- a/backends-velox/src/test/scala/org/apache/gluten/extension/columnar/enumerated/planner/VeloxRasSuite.scala +++ b/backends-velox/src/test/scala/org/apache/gluten/extension/columnar/enumerated/planner/VeloxRasSuite.scala @@ -89,7 +89,7 @@ class VeloxRasSuite extends SharedSparkSession { object ConvertRowUnaryToColumnar extends RasRule[SparkPlan] { override def shift(node: SparkPlan): Iterable[SparkPlan] = node match { case RowUnary(child) => List(ColumnarUnary(child)) - case other => List.empty + case _ => List.empty } override def shape(): Shape[SparkPlan] = Shapes.fixedHeight(1) diff --git a/backends-velox/src/test/scala/org/apache/gluten/functions/JsonFunctionsValidateSuite.scala b/backends-velox/src/test/scala/org/apache/gluten/functions/JsonFunctionsValidateSuite.scala index c387c5c234ca..7331054c4818 100644 --- a/backends-velox/src/test/scala/org/apache/gluten/functions/JsonFunctionsValidateSuite.scala +++ b/backends-velox/src/test/scala/org/apache/gluten/functions/JsonFunctionsValidateSuite.scala @@ -34,8 +34,8 @@ class JsonFunctionsValidateSuite extends FunctionsValidateSuite { withTempPath { path => - Seq[(String)]( - ("""{"a":"b"}""") + Seq[String]( + """{"a":"b"}""" ) .toDF("txt") .write @@ -65,9 +65,9 @@ class JsonFunctionsValidateSuite extends FunctionsValidateSuite { s"from datatab limit 5")(checkGlutenOperatorMatch[ProjectExecTransformer]) withTempPath { path => - Seq[(String)]( - ("[1,2,3,4]"), - (null.asInstanceOf[String]) + Seq[String]( + "[1,2,3,4]", + null.asInstanceOf[String] ) .toDF("txt") .write @@ -84,12 +84,12 @@ class JsonFunctionsValidateSuite extends FunctionsValidateSuite { testWithMinSparkVersion("from_json function bool", "3.4") { withTempPath { path => - Seq[(String)]( - ("""{"id":0}"""), - ("""{"id":0.0}"""), - ("""{"id":true}"""), - ("""{"id":false}"""), - ("""{"id":"true"}""") + Seq[String]( + """{"id":0}""", + """{"id":0.0}""", + """{"id":true}""", + """{"id":false}""", + """{"id":"true"}""" ) .toDF("txt") .write @@ -106,12 +106,12 @@ class JsonFunctionsValidateSuite extends FunctionsValidateSuite { testWithMinSparkVersion("from_json function small int", "3.4") { withTempPath { path => - Seq[(String)]( - ("""{"id":100000000}"""), - ("""{"id":11.0}"""), - ("""{"id":'true'}"""), - ("""{"id":true}"""), - ("""{"id":'12'}""") + Seq[String]( + """{"id":100000000}""", + """{"id":11.0}""", + """{"id":'true'}""", + """{"id":true}""", + """{"id":'12'}""" ) .toDF("txt") .write @@ -128,12 +128,12 @@ class JsonFunctionsValidateSuite extends FunctionsValidateSuite { testWithMinSparkVersion("from_json function int", "3.4") { withTempPath { path => - Seq[(String)]( - ("""{"id":10}"""), - ("""{"id":11.0}"""), - ("""{"id":"true"}"""), - ("""{"id":true}"""), - ("""{"id":"12"}""") + Seq[String]( + """{"id":10}""", + """{"id":11.0}""", + """{"id":"true"}""", + """{"id":true}""", + """{"id":"12"}""" ) .toDF("txt") .write @@ -150,12 +150,12 @@ class JsonFunctionsValidateSuite extends FunctionsValidateSuite { testWithMinSparkVersion("from_json function big int", "3.4") { withTempPath { path => - Seq[(String)]( - ("""{"id":100000000}"""), - ("""{"id":11.0}"""), - ("""{"id":'true'}"""), - ("""{"id":true}"""), - ("""{"id":'12'}""") + Seq[String]( + """{"id":100000000}""", + """{"id":11.0}""", + """{"id":'true'}""", + """{"id":true}""", + """{"id":'12'}""" ) .toDF("txt") .write @@ -172,14 +172,14 @@ class JsonFunctionsValidateSuite extends FunctionsValidateSuite { testWithMinSparkVersion("from_json function float", "3.4") { withTempPath { path => - Seq[(String)]( - ("""{"id":10}"""), - ("""{"id":11.0}"""), - ("""{"id":"12.0"}"""), - ("""{"id":"test"}"""), - ("""{"id":"12"}"""), - ("""{"id":"-INF"}"""), - ("""{"id":"NaN"}""") + Seq[String]( + """{"id":10}""", + """{"id":11.0}""", + """{"id":"12.0"}""", + """{"id":"test"}""", + """{"id":"12"}""", + """{"id":"-INF"}""", + """{"id":"NaN"}""" ) .toDF("txt") .write @@ -196,14 +196,14 @@ class JsonFunctionsValidateSuite extends FunctionsValidateSuite { testWithMinSparkVersion("from_json function double", "3.4") { withTempPath { path => - Seq[(String)]( - ("""{"id":10}"""), - ("""{"id":11.0}"""), - ("""{"id":"12.0"}"""), - ("""{"id":"test"}"""), - ("""{"id":"12"}"""), - ("""{"id":"+INF"}"""), - ("""{"id":"NaN"}""") + Seq[String]( + """{"id":10}""", + """{"id":11.0}""", + """{"id":"12.0"}""", + """{"id":"test"}""", + """{"id":"12"}""", + """{"id":"+INF"}""", + """{"id":"NaN"}""" ) .toDF("txt") .write @@ -220,12 +220,12 @@ class JsonFunctionsValidateSuite extends FunctionsValidateSuite { testWithMinSparkVersion("from_json function string", "3.4") { withTempPath { path => - Seq[(String)]( - ("""{"id":10}"""), - ("""{"id":false}"""), - ("""{"id":"00010"}"""), - ("""{"id":[1,2]}"""), - ("""{"id":{"a":1}}""") + Seq[String]( + """{"id":10}""", + """{"id":false}""", + """{"id":"00010"}""", + """{"id":[1,2]}""", + """{"id":{"a":1}}""" ) .toDF("txt") .write @@ -242,10 +242,10 @@ class JsonFunctionsValidateSuite extends FunctionsValidateSuite { testWithMinSparkVersion("from_json function array", "3.4") { withTempPath { path => - Seq[(String)]( - ("""[]"""), - ("""[1, 3]"""), - ("""[1, 2, 3.0]""") + Seq[String]( + """[]""", + """[1, 3]""", + """[1, 2, 3.0]""" ) .toDF("txt") .write @@ -262,12 +262,12 @@ class JsonFunctionsValidateSuite extends FunctionsValidateSuite { testWithMinSparkVersion("from_json function map", "3.4") { withTempPath { path => - Seq[(String)]( - ("""{"id":10, "value":11}"""), - ("""{"id":11, "value":11.0}"""), - ("""{"id":10, "Id":11}"""), - ("""{4:10, "Id":11}"""), - ("""{}""") + Seq[String]( + """{"id":10, "value":11}""", + """{"id":11, "value":11.0}""", + """{"id":10, "Id":11}""", + """{4:10, "Id":11}""", + """{}""" ) .toDF("txt") .write @@ -284,10 +284,10 @@ class JsonFunctionsValidateSuite extends FunctionsValidateSuite { testWithMinSparkVersion("from_json function row", "3.4") { withTempPath { path => - Seq[(String)]( - ("""{"Id":"10", "Value":"11"}"""), - ("""{"Id":"11", "Value":"11.0"}"""), - ("""{"Id":"10", "Value":"11"}""") + Seq[String]( + """{"Id":"10", "Value":"11"}""", + """{"Id":"11", "Value":"11.0"}""", + """{"Id":"10", "Value":"11"}""" ) .toDF("txt") .write @@ -304,9 +304,9 @@ class JsonFunctionsValidateSuite extends FunctionsValidateSuite { test("from_json function CORRUPT_RECORD") { withTempPath { path => - Seq[(String)]( - ("""{"id":00010}"""), - ("""{"id":1.0}""") + Seq[String]( + """{"id":00010}""", + """{"id":1.0}""" ) .toDF("txt") .write @@ -324,9 +324,9 @@ class JsonFunctionsValidateSuite extends FunctionsValidateSuite { testWithMinSparkVersion("from_json function duplicate key", "3.4") { withTempPath { path => - Seq[(String)]( - ("""{"id":1,"Id":2}"""), - ("""{"id":3,"Id":4}""") + Seq[String]( + """{"id":1,"Id":2}""", + """{"id":3,"Id":4}""" ) .toDF("txt") .write @@ -351,20 +351,20 @@ class JsonFunctionsValidateSuite extends FunctionsValidateSuite { test("json_object_keys") { withTempPath { path => - Seq[(String)]( - (""""""), - ("""200"""), - ("""{}"""), - ("""{"key": 1}"""), - ("""{"key": "value", "key2": 2}"""), - ("""{"arrayKey": [1, 2, 3]}"""), - ("""{"key":[1,2,3,{"key":"value"},[1,2,3]]}"""), - ("""{"f1":"abc","f2":{"f3":"a", "f4":"b"}}"""), - ("""{"k1": [1, 2, {"key": 5}], "k2": {"key2": [1, 2]}}"""), - ("""[1, 2, 3]"""), - ("""{[1,2]}"""), - ("""{"key": 45, "random_string"}"""), - (null.asInstanceOf[String]) + Seq[String]( + """""", + """200""", + """{}""", + """{"key": 1}""", + """{"key": "value", "key2": 2}""", + """{"arrayKey": [1, 2, 3]}""", + """{"key":[1,2,3,{"key":"value"},[1,2,3]]}""", + """{"f1":"abc","f2":{"f3":"a", "f4":"b"}}""", + """{"k1": [1, 2, {"key": 5}], "k2": {"key2": [1, 2]}}""", + """[1, 2, 3]""", + """{[1,2]}""", + """{"key": 45, "random_string"}""", + null.asInstanceOf[String] ) .toDF("txt") .write diff --git a/backends-velox/src/test/scala/org/apache/gluten/functions/ScalarFunctionsValidateSuite.scala b/backends-velox/src/test/scala/org/apache/gluten/functions/ScalarFunctionsValidateSuite.scala index 6bef01e96f01..097e6fc68e35 100644 --- a/backends-velox/src/test/scala/org/apache/gluten/functions/ScalarFunctionsValidateSuite.scala +++ b/backends-velox/src/test/scala/org/apache/gluten/functions/ScalarFunctionsValidateSuite.scala @@ -161,8 +161,8 @@ abstract class ScalarFunctionsValidateSuite extends FunctionsValidateSuite { testWithMinSparkVersion("null input for array_size", "3.3") { withTempPath { path => - Seq[(Array[Int])]( - (null.asInstanceOf[Array[Int]]) + Seq[Array[Int]]( + null.asInstanceOf[Array[Int]] ) .toDF("txt") .write @@ -190,7 +190,7 @@ abstract class ScalarFunctionsValidateSuite extends FunctionsValidateSuite { } test("shiftright") { - val df = runQueryAndCompare("SELECT shiftright(int_field1, 1) from datatab limit 1") { + runQueryAndCompare("SELECT shiftright(int_field1, 1) from datatab limit 1") { checkGlutenOperatorMatch[ProjectExecTransformer] } } @@ -381,7 +381,7 @@ abstract class ScalarFunctionsValidateSuite extends FunctionsValidateSuite { test("map_filter") { withTempPath { path => - Seq((Map("a" -> 1, "b" -> 2, "c" -> 3))) + Seq(Map("a" -> 1, "b" -> 2, "c" -> 3)) .toDF("m") .write .parquet(path.getCanonicalPath) @@ -1002,7 +1002,7 @@ abstract class ScalarFunctionsValidateSuite extends FunctionsValidateSuite { runQueryAndCompare("SELECT l_orderkey, input_file_name() as name FROM lineitem") { df => val plan = df.queryExecution.executedPlan - assert(collect(plan) { case f: ProjectExecTransformer => f }.size == 0) + assert(collect(plan) { case f: ProjectExecTransformer => f }.isEmpty) assert(collect(plan) { case f: ProjectExec => f }.size == 1) } } @@ -1060,7 +1060,7 @@ abstract class ScalarFunctionsValidateSuite extends FunctionsValidateSuite { withTempView("try_cast_table") { withTempPath { path => - Seq[(String)](("123456"), ("000A1234")) + Seq[String]("123456", "000A1234") .toDF("str") .write .parquet(path.getCanonicalPath) @@ -1112,7 +1112,7 @@ abstract class ScalarFunctionsValidateSuite extends FunctionsValidateSuite { withTempView("cast_table") { withTempPath { path => - Seq[(String)](("123456"), ("000A1234")) + Seq[String]("123456", "000A1234") .toDF("str") .write .parquet(path.getCanonicalPath) diff --git a/backends-velox/src/test/scala/org/apache/spark/memory/GlobalOffHeapMemorySuite.scala b/backends-velox/src/test/scala/org/apache/spark/memory/GlobalOffHeapMemorySuite.scala index 3a46c1ac1ada..084386fcd7e1 100644 --- a/backends-velox/src/test/scala/org/apache/spark/memory/GlobalOffHeapMemorySuite.scala +++ b/backends-velox/src/test/scala/org/apache/spark/memory/GlobalOffHeapMemorySuite.scala @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.spark.memory; +package org.apache.spark.memory import org.apache.gluten.config.GlutenCoreConfig import org.apache.gluten.exception.GlutenException @@ -28,7 +28,7 @@ import org.apache.spark.task.TaskResources import org.scalatest.BeforeAndAfterAll import org.scalatest.funsuite.AnyFunSuite -import java.util.Collections; +import java.util.Collections class GlobalOffHeapMemorySuite extends AnyFunSuite with BeforeAndAfterAll { diff --git a/backends-velox/src/test/scala/org/apache/spark/sql/execution/VeloxExpandSuite.scala b/backends-velox/src/test/scala/org/apache/spark/sql/execution/VeloxExpandSuite.scala index f8e4e0c2c1cc..b3e1f14f4cdb 100644 --- a/backends-velox/src/test/scala/org/apache/spark/sql/execution/VeloxExpandSuite.scala +++ b/backends-velox/src/test/scala/org/apache/spark/sql/execution/VeloxExpandSuite.scala @@ -71,10 +71,8 @@ class VeloxExpandSuite extends VeloxWholeStageTransformerSuite { df.collect() spark.sparkContext.listenerBus.waitUntilEmpty() assert( - events - .find(_.fallbackNodeToReason.values.toSet.exists( - _.contains("Failed to bind reference for"))) - .isEmpty) + !events.exists( + _.fallbackNodeToReason.values.toSet.exists(_.contains("Failed to bind reference for")))) } finally { spark.sparkContext.removeSparkListener(listener) } diff --git a/backends-velox/src/test/scala/org/apache/spark/sql/execution/joins/GlutenExistenceJoinSuite.scala b/backends-velox/src/test/scala/org/apache/spark/sql/execution/joins/GlutenExistenceJoinSuite.scala index 4c6508f69aae..bfb68d4cae3e 100644 --- a/backends-velox/src/test/scala/org/apache/spark/sql/execution/joins/GlutenExistenceJoinSuite.scala +++ b/backends-velox/src/test/scala/org/apache/spark/sql/execution/joins/GlutenExistenceJoinSuite.scala @@ -66,7 +66,7 @@ class GlutenExistenceJoinSuite extends VeloxWholeStageTransformerSuite with SQLT val existsAttr = AttributeReference("exists", BooleanType, nullable = false)() - val joinCondition: Expression = LessThan(leftPlan.output(0), rightPlan.output(0)) + val joinCondition: Expression = LessThan(leftPlan.output.head, rightPlan.output.head) val existenceJoin = Join( left = leftPlan, diff --git a/backends-velox/src/test/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelationTest.scala b/backends-velox/src/test/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelationTest.scala index 9aed31476e53..1017fd07238c 100644 --- a/backends-velox/src/test/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelationTest.scala +++ b/backends-velox/src/test/scala/org/apache/spark/sql/execution/unsafe/UnsafeColumnarBuildSideRelationTest.scala @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.spark.sql.execution.unsafe; +package org.apache.spark.sql.execution.unsafe import org.apache.spark.{SparkConf, SparkEnv} import org.apache.spark.serializer.{JavaSerializer, KryoSerializer} @@ -22,7 +22,7 @@ import org.apache.spark.sql.catalyst.expressions.AttributeReference import org.apache.spark.sql.catalyst.plans.physical.IdentityBroadcastMode import org.apache.spark.sql.execution.joins.HashedRelationBroadcastMode import org.apache.spark.sql.test.SharedSparkSession -import org.apache.spark.sql.types.StringType; +import org.apache.spark.sql.types.StringType class UnsafeColumnarBuildSideRelationTest extends SharedSparkSession { override protected def sparkConf: SparkConf = { @@ -31,8 +31,8 @@ class UnsafeColumnarBuildSideRelationTest extends SharedSparkSession { .set("spark.memory.offHeap.enabled", "true") } - var unsafeRelWithIdentityMode: UnsafeColumnarBuildSideRelation = null - var unsafeRelWithHashMode: UnsafeColumnarBuildSideRelation = null + var unsafeRelWithIdentityMode: UnsafeColumnarBuildSideRelation = _ + var unsafeRelWithHashMode: UnsafeColumnarBuildSideRelation = _ override def beforeAll(): Unit = { super.beforeAll()