Skip to content

feat(sql): add bool_and() and bool_or() aggregate functions#6658

Merged
bluestreak01 merged 1 commit intomasterfrom
vi_bool_and
Jan 18, 2026
Merged

feat(sql): add bool_and() and bool_or() aggregate functions#6658
bluestreak01 merged 1 commit intomasterfrom
vi_bool_and

Conversation

@bluestreak01
Copy link
Copy Markdown
Member

Summary

  • Add bool_and(T) aggregate function - returns true if all values are true, false otherwise
  • Add bool_or(T) aggregate function - returns true if any value is true, false otherwise

Features

  • Support for parallel execution via merge() method
  • Works with GROUP BY clauses
  • Works with SAMPLE BY clauses
  • Accepts boolean expressions as arguments (e.g., bool_and(x > 5))
  • Constant folding optimization - when argument is constant, returns result directly without row-by-row computation

Test plan

  • Unit tests for basic functionality (all true, all false, mixed)
  • Tests for empty tables
  • Tests with GROUP BY
  • Tests with SAMPLE BY
  • Tests with boolean expressions
  • Tests for constant folding optimization

🤖 Generated with Claude Code

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 16, 2026

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@glasstiger
Copy link
Copy Markdown
Contributor

[PR Coverage check]

😍 pass : 66 / 92 (71.74%)

file detail

path covered line new line coverage
🔵 io/questdb/griffin/engine/functions/groupby/BoolAndGroupByFunction.java 25 38 65.79%
🔵 io/questdb/griffin/engine/functions/groupby/BoolOrGroupByFunction.java 25 38 65.79%
🔵 io/questdb/griffin/engine/functions/groupby/BoolOrGroupByFunctionFactory.java 7 7 100.00%
🔵 io/questdb/griffin/engine/functions/groupby/BoolAndGroupByFunctionFactory.java 7 7 100.00%
🔵 io/questdb/griffin/engine/functions/bool/AndFunctionFactory.java 2 2 100.00%

@bluestreak01 bluestreak01 added New feature Feature requests SQL Issues or changes relating to SQL execution labels Jan 18, 2026
@bluestreak01 bluestreak01 merged commit e865a19 into master Jan 18, 2026
43 checks passed
@bluestreak01 bluestreak01 deleted the vi_bool_and branch January 18, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New feature Feature requests SQL Issues or changes relating to SQL execution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants