Skip to content

fix(executor): preserve set operation multiplicity [CODEX]#7955

Open
dev-willbird1936 wants to merge 1 commit into
tobymao:mainfrom
dev-willbird1936:fix/executor-set-operation-multiplicity
Open

fix(executor): preserve set operation multiplicity [CODEX]#7955
dev-willbird1936 wants to merge 1 commit into
tobymao:mainfrom
dev-willbird1936:fix/executor-set-operation-multiplicity

Conversation

@dev-willbird1936

Copy link
Copy Markdown
Contributor

Fixes #7954.

PythonExecutor.set_operation currently applies set semantics to INTERSECT and EXCEPT even when the planned operation is ALL. This change consumes right-side row counts for ALL, while retaining one stable first occurrence for DISTINCT.

The regression covers excess left multiplicity, unmatched rows, and both DISTINCT controls.

Validation:

  • python -m unittest tests.test_executor.TestExecutor.test_set_operations
  • python -m unittest tests.test_executor (21 tests)
  • ruff check sqlglot/executor/python.py tests/test_executor.py
  • ruff format --check sqlglot/executor/python.py tests/test_executor.py
  • mypy sqlglot (180 source files)
  • git diff --check origin/main...HEAD

LLM disclosure: Codex assisted with analysis, implementation review, and validation. I reviewed the final behavior, tests, and diff and take responsibility for the contribution.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python executor INTERSECT ALL and EXCEPT ALL discard multiplicity

1 participant