Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
96dc914
Added redundant HAS removal optimization and updated tests, WIP handl…
knassre-bodo Jan 23, 2026
03630d3
Working on filter merging program
knassre-bodo Jan 26, 2026
97600a1
Fixed edge case with children steps, updated test files, need to add …
knassre-bodo Jan 26, 2026
280a109
Merge branch 'main' into kian/perfopt
knassre-bodo Jan 27, 2026
f2db222
Resolving test issues [RUN CI]
knassre-bodo Jan 27, 2026
7c0ab19
switch redundant has and add tests
hadia206 Jan 27, 2026
f074118
add test files
hadia206 Jan 27, 2026
7d72a7d
Added more testing layers and window bugfixes
knassre-bodo Jan 27, 2026
6c06d74
[run CI][run SF][run mysql][run postgres] BIRD menu_5556 and update o…
hadia206 Jan 28, 2026
307c601
Resolving bugs and updating tests [RUN CI]
knassre-bodo Jan 29, 2026
87eec09
Removing old
knassre-bodo Jan 29, 2026
4670c63
Resolving conflicts with singular-has removal
knassre-bodo Jan 29, 2026
9fe336c
Added extra BIRD tests
knassre-bodo Jan 29, 2026
8237128
Added more multiple_filter tests and removed the sql file testing
knassre-bodo Jan 30, 2026
078347e
Adding functionality to work with HAS children
knassre-bodo Jan 30, 2026
bcf7fa7
Adding partial disjoint merge handling
knassre-bodo Jan 30, 2026
9012d0f
Updating restaurant_gen14
knassre-bodo Jan 30, 2026
0d77988
[run all] address comments
hadia206 Feb 6, 2026
1abba6a
Merge branch 'main' into Hadia/remove_has_singular
hadia206 Feb 6, 2026
bb49497
Fixing disjunction issues and new tests
knassre-bodo Feb 6, 2026
f13ee05
Merge branch 'Hadia/remove_has_singular' into kian/perfopt
knassre-bodo Feb 6, 2026
2a6e253
Resolving conflicts
knassre-bodo Feb 9, 2026
509e159
Resolving testing and deletion issues
knassre-bodo Feb 9, 2026
974eaf6
Documentation and cleanup
knassre-bodo Feb 9, 2026
d3e33b7
WIP overhauls
knassre-bodo Feb 10, 2026
790c0dd
Resolving conflicts
knassre-bodo Feb 10, 2026
0a34d04
[RUN CI]
knassre-bodo Feb 10, 2026
cb9cb36
WIP
knassre-bodo Feb 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions pydough/conversion/hybrid_expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
"HybridFunctionExpr",
"HybridLiteralExpr",
"HybridRefExpr",
"make_condition",
]

import copy
from abc import ABC, abstractmethod
from collections.abc import Collection

import pydough.pydough_operators as pydop
from pydough.qdag import (
Expand Down Expand Up @@ -766,3 +768,30 @@ def expand_sided(self, shift: int) -> HybridExpr:
self.typ,
self.kwargs,
)


def make_condition(
expressions: Collection[HybridExpr], conjunction: bool
) -> HybridExpr:
"""
Converts a list of expressions into a composite boolean expression, either
a conjunction or disjunction. If the list is empty, returns a literal True
expression.

Args:
`expressions`: the expressions to combine into a condition.
`conjunction`: whether to combine the expressions using AND (if True) or
OR (if False).

Returns:
The combined condition expression.
"""
if not expressions:
return HybridLiteralExpr(Literal(True, BooleanType()))
if len(expressions) == 1:
return next(iter(expressions))
if conjunction:
return HybridFunctionExpr(
pydop.BAN, sorted(expressions, key=repr), BooleanType()
)
return HybridFunctionExpr(pydop.BOR, sorted(expressions, key=repr), BooleanType())
Loading