Skip to content

Regression: bit_and aggregate function is incorrect #6955

Closed

Description

@alamb

Describe the bug

#6904 introduced a bug where bit_and when a GROUP BY will now return zero always

This was found with the tests added in #6952

To Reproduce

Run test in #6952

External error: query result mismatch:
[SQL] SELECT
  bit_and(c1),
  bit_and(c2),
  bit_and(c3),
  bit_or(c1),
  bit_or(c2),
  bit_or(c3),
  bit_xor(c1),
  bit_xor(c2),
  bit_xor(c3),
  tag
FROM bit_aggregate_functions
GROUP BY tag
ORDER BY tag
[Diff] (-expected|+actual)
-   1 8 11 13 14 11 12 6 11 A
-   33 11 NULL 33 11 NULL 33 11 NULL B
+   0 0 0 13 14 11 12 6 11 A
+   0 0 NULL 33 11 NULL 33 11 NULL B
at tests/sqllogictests/test_files/aggregate.slt:1546

Expected behavior

Test should pass

Additional context

No response

Activity

  1. izveigor commented on Jul 13, 2023

    @izveigor
    Contributor

    @alamb I think the main problem is with the default value. (for bit_and it is -1).

  2. alamb commented on Jul 13, 2023

    @alamb
    ContributorAuthor

    @alamb I think the main problem is with the default value. (for bit_and it is -1).

    You are 100% correct -- thank you @izveigor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions