@@ -1292,6 +1292,34 @@ class CometAggregateSuite extends CometTestBase with AdaptiveSparkPlanHelper {
12921292 }
12931293 }
12941294
1295+ test(" bitwise aggregates allow Spark partial and Comet final" ) {
1296+ withSQLConf(
1297+ CometConf .COMET_EXEC_SHUFFLE_ENABLED .key -> " true" ,
1298+ CometConf .COMET_SHUFFLE_MODE .key -> " jvm" ,
1299+ CometConf .COMET_ENABLE_PARTIAL_HASH_AGGREGATE .key -> " false" ,
1300+ CometConf .COMET_ENABLE_FINAL_HASH_AGGREGATE .key -> " true" ,
1301+ CometConf .COMET_EXEC_LOCAL_TABLE_SCAN_ENABLED .key -> " true" ) {
1302+ val table = " bitwise_mixed"
1303+ withTable(table) {
1304+ sql(
1305+ s " create table $table(col1 long, col2 int, col3 short, col4 byte, grp int) using parquet " )
1306+ sql(
1307+ s " insert into $table values " +
1308+ " (4, 1, 1, 3, 0), (4, 1, 1, 3, 0), (3, 3, 1, 4, 1)," +
1309+ " (2, 4, 2, 5, 1), (1, 3, 2, 6, 0)" )
1310+
1311+ // Partial aggregate stays in Spark, final aggregate runs in Comet.
1312+ checkSparkAnswerAndNumOfAggregates(
1313+ s " SELECT grp, BIT_AND(col1), BIT_OR(col1), BIT_XOR(col1), " +
1314+ " BIT_AND(col2), BIT_OR(col2), BIT_XOR(col2)," +
1315+ " BIT_AND(col3), BIT_OR(col3), BIT_XOR(col3)," +
1316+ " BIT_AND(col4), BIT_OR(col4), BIT_XOR(col4)" +
1317+ s " FROM $table GROUP BY grp " ,
1318+ 1 )
1319+ }
1320+ }
1321+ }
1322+
12951323 def setupAndTestAggregates (
12961324 table : String ,
12971325 data : Seq [(Any , Any , Any )],
0 commit comments