@@ -40,15 +40,7 @@ class CometCostModelSuite extends CometTestBase {
4040 withCBOEnabled {
4141 withTempView(" test_data" ) {
4242 createSimpleTestData()
43- // Create a more complex query that will trigger AQE with joins/aggregations
44- val query = """
45- SELECT t1.len1, t2.len2, COUNT(*) as cnt
46- FROM (SELECT length(text1) as len1, text1 FROM test_data) t1
47- JOIN (SELECT length(text2) as len2, text2 FROM test_data) t2
48- ON t1.text1 = t2.text2
49- GROUP BY t1.len1, t2.len2
50- """
51-
43+ val query = " SELECT length(text1), length(text2) FROM test_data"
5244 executeAndCheckOperator(
5345 query,
5446 classOf [CometProjectExec ],
@@ -61,15 +53,7 @@ class CometCostModelSuite extends CometTestBase {
6153 withCBOEnabled {
6254 withTempView(" test_data" ) {
6355 createPaddedTestData()
64- // Create a more complex query that will trigger AQE with joins/aggregations
65- val query = """
66- SELECT t1.trimmed1, t2.trimmed2, COUNT(*) as cnt
67- FROM (SELECT trim(text1) as trimmed1, text1 FROM test_data) t1
68- JOIN (SELECT trim(text2) as trimmed2, text2 FROM test_data) t2
69- ON t1.text1 = t2.text2
70- GROUP BY t1.trimmed1, t2.trimmed2
71- """
72-
56+ val query = " SELECT trim(text1), trim(text2) FROM test_data"
7357 executeAndCheckOperator(
7458 query,
7559 classOf [ProjectExec ],
@@ -78,45 +62,6 @@ class CometCostModelSuite extends CometTestBase {
7862 }
7963 }
8064
81- test(" Without CBO, Comet should be used regardless of expression cost" ) {
82- withCBODisabled {
83- withTempView(" test_data" ) {
84- createPaddedTestData()
85- // Complex query without CBO
86- val query = """
87- SELECT trim(text1) as trimmed1, COUNT(*) as cnt
88- FROM test_data
89- GROUP BY trim(text1)
90- """
91-
92- executeAndCheckOperator(
93- query,
94- classOf [CometProjectExec ],
95- " Expected CometProjectExec when CBO disabled" )
96- }
97- }
98- }
99-
100- test(" Mixed expressions should use appropriate operators per expression cost" ) {
101- withCBOEnabled {
102- withTempView(" test_data" ) {
103- createSimpleTestData()
104- // Query mixing fast (length: 9.1x) and slow (ascii: 0.6x) expressions with aggregation
105- // Average acceleration: (9.1 + 0.6) / 2 = 4.85x -> cost = 0.206 (still prefer Comet)
106- val query = """
107- SELECT length(text1) as fast_expr, ascii(text1) as slow_expr, COUNT(*) as cnt
108- FROM test_data
109- GROUP BY length(text1), ascii(text1)
110- """
111-
112- executeAndCheckOperator(
113- query,
114- classOf [CometProjectExec ],
115- " Expected CometProjectExec for mixed expressions with positive average" )
116- }
117- }
118- }
119-
12065 /** Helper method to run tests with CBO enabled */
12166 private def withCBOEnabled (f : => Unit ): Unit = {
12267 withSQLConf(
@@ -176,7 +121,7 @@ class CometCostModelSuite extends CometTestBase {
176121 val tempPath = s " ${System .getProperty(" java.io.tmpdir" )}/comet_cost_test_ ${System .nanoTime()}"
177122 df.write.mode(" overwrite" ).parquet(tempPath)
178123
179- val parquetDf = spark.read.parquet(tempPath)
124+ val parquetDf = spark.read.parquet(tempPath).repartition( 5 )
180125 parquetDf.createOrReplaceTempView(" test_data" )
181126 }
182127
@@ -193,7 +138,7 @@ class CometCostModelSuite extends CometTestBase {
193138 s " ${System .getProperty(" java.io.tmpdir" )}/comet_cost_test_padded_ ${System .nanoTime()}"
194139 df.write.mode(" overwrite" ).parquet(tempPath)
195140
196- val parquetDf = spark.read.parquet(tempPath)
141+ val parquetDf = spark.read.parquet(tempPath).repartition( 5 )
197142 parquetDf.createOrReplaceTempView(" test_data" )
198143 }
199144
0 commit comments