Skip to content

Commit 9e13649

Browse files
authored
test: move bit_count boundary coverage to SQL fixtures (apache#6655)
1 parent 78b0eb0 commit 9e13649

2 files changed

Lines changed: 50 additions & 23 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
-- Licensed to the Apache Software Foundation (ASF) under one
2+
-- or more contributor license agreements. See the NOTICE file
3+
-- distributed with this work for additional information
4+
-- regarding copyright ownership. The ASF licenses this file
5+
-- to you under the Apache License, Version 2.0 (the
6+
-- "License"); you may not use this file except in compliance
7+
-- with the License. You may obtain a copy of the License at
8+
--
9+
-- http://www.apache.org/licenses/LICENSE-2.0
10+
--
11+
-- Unless required by applicable law or agreed to in writing,
12+
-- software distributed under the License is distributed on an
13+
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
-- KIND, either express or implied. See the License for the
15+
-- specific language governing permissions and limitations
16+
-- under the License.
17+
18+
-- ConfigMatrix: parquet.enable.dictionary=false,true
19+
20+
-- Spark 3.4.3 emits invalid Java for bit_count(boolean). Use interpreted Spark
21+
-- reference execution; plain queries still assert Comet operator replacement.
22+
-- Config: spark.sql.codegen.wholeStage=false
23+
-- Config: spark.sql.codegen.factoryMode=NO_CODEGEN
24+
25+
statement
26+
CREATE TABLE test_bit_count_types(l bigint, i int, s smallint, b tinyint, flag boolean) USING parquet
27+
28+
statement
29+
INSERT INTO test_bit_count_types
30+
SELECT /*+ COALESCE(1) */ l, i, s, b, flag
31+
FROM VALUES
32+
(1111, 2222, 17, 7, true),
33+
(9223372036854775807, 2147483647, 32767, 127, true),
34+
(-9223372036854775808, -2147483648, -32768, -128, false),
35+
(-1, -1, -1, -1, false),
36+
(0, 0, 0, 0, false),
37+
(1, 1, 1, 1, true),
38+
(4294967293, 0, 0, 0, true),
39+
(4294967294, 0, 0, 0, false),
40+
(4294967295, 0, 0, 0, true),
41+
(4294967296, 0, 0, 0, false),
42+
(NULL, NULL, NULL, NULL, NULL)
43+
AS input(l, i, s, b, flag)
44+
45+
query
46+
SELECT bit_count(l), bit_count(i), bit_count(s), bit_count(b), bit_count(flag)
47+
FROM test_bit_count_types
48+
49+
query
50+
SELECT bit_count(true), bit_count(false) FROM test_bit_count_types

‎spark/src/test/scala/org/apache/comet/CometBitwiseExpressionSuite.scala‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -116,29 +116,6 @@ class CometBitwiseExpressionSuite extends CometTestBase with AdaptiveSparkPlanHe
116116
}
117117
}
118118

119-
test("bitwise_count - min/max values") {
120-
Seq(false, true).foreach { dictionary =>
121-
withSQLConf("parquet.enable.dictionary" -> dictionary.toString) {
122-
val table = "bitwise_count_test"
123-
withTable(table) {
124-
sql(s"create table $table(col1 long, col2 int, col3 short, col4 byte) using parquet")
125-
sql(s"insert into $table values(1111, 2222, 17, 7)")
126-
sql(
127-
s"insert into $table values(${Long.MaxValue}, ${Int.MaxValue}, ${Short.MaxValue}, ${Byte.MaxValue})")
128-
sql(
129-
s"insert into $table values(${Long.MinValue}, ${Int.MinValue}, ${Short.MinValue}, ${Byte.MinValue})")
130-
131-
checkSparkAnswerAndOperator(sql(s"SELECT bit_count(col1) FROM $table"))
132-
checkSparkAnswerAndOperator(sql(s"SELECT bit_count(col2) FROM $table"))
133-
checkSparkAnswerAndOperator(sql(s"SELECT bit_count(col3) FROM $table"))
134-
checkSparkAnswerAndOperator(sql(s"SELECT bit_count(col4) FROM $table"))
135-
checkSparkAnswerAndOperator(sql(s"SELECT bit_count(true) FROM $table"))
136-
checkSparkAnswerAndOperator(sql(s"SELECT bit_count(false) FROM $table"))
137-
}
138-
}
139-
}
140-
}
141-
142119
test("bitwise_count - random values (spark gen)") {
143120
withTempDir { dir =>
144121
val path = new Path(dir.toURI.toString, "test.parquet")

0 commit comments

Comments
 (0)