Skip to content

Conversation

@kazantsev-maksim
Copy link
Contributor

Which issue does this PR close?

Closes #18225

Rationale for this change

After adding the bit_count function in Comet, we got different results from Spark. (apache/datafusion-comet#2553)

Are these changes tested?

Tested with existing unit tests

@github-actions github-actions bot added sqllogictest SQL Logic Tests (.slt) spark labels Oct 28, 2025
let value_array = value_array[0].as_ref();
match value_array.data_type() {
DataType::Int8 => {
DataType::Int8 | DataType::Boolean => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spark supports only signed int types

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment seems misplaced as the code adds support for boolean 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think this code will now panic if you pass in a Boolean array

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to note that Spark only supports signed integer and boolean types as input.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an additional test for BooleanArray.

@Jefffrey Jefffrey added this pull request to the merge queue Nov 2, 2025
Merged via the queue into apache:main with commit d445b61 Nov 2, 2025
28 checks passed
tobixdev pushed a commit to tobixdev/datafusion that referenced this pull request Nov 2, 2025
## Which issue does this PR close?

Closes apache#18225

## Rationale for this change

After adding the bit_count function in Comet, we got different results
from Spark. (apache/datafusion-comet#2553)

## Are these changes tested?

Tested with existing unit tests

---------

Co-authored-by: Kazantsev Maksim <mn.kazantsev@gmail.com>
Co-authored-by: Jeffrey Vo <jeffrey.vo.australia@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spark sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bit_count in spark create not fuly compatible with spark

3 participants