Skip to content

Support INTERSECT ALL and EXCEPT ALL to close #2801 - #3027

Open
mateuscmtropical wants to merge 2 commits into
AlaSQL:developfrom
mateuscmtropical:fix/2801-intersect-except-all
Open

mateuscmtropical wants to merge 2 commits into
AlaSQL:developfrom
mateuscmtropical:fix/2801-intersect-except-all

Conversation

@mateuscmtropical

Copy link
Copy Markdown
Contributor

Closes #2801

What was wrong

INTERSECT ALL and EXCEPT ALL were parse errors. UNION ALL, INTERSECT and EXCEPT worked.

What changed

  • UnionOp gets EXCEPT ALL and INTERSECT ALL. They set all on the select next to corresponding, and toString prints it back.
  • arrayExceptDeep and arrayIntersectDeep take an optional all. With it, each row of the right side matches one row of the left side only, so duplicates are counted: EXCEPT ALL subtracts the counts and INTERSECT ALL keeps the smaller count.
  • Plain INTERSECT and EXCEPT are unchanged. The grammar still has 282 conflicts.

Tests

test/test2801.js covers both operators with the data from the issue, lower case with ORDER BY, and a toString round trip. All four are parse errors without the fix.

yarn test-only gives 2555 pass. The only failures are the 5 Test 418 cases that load files from the internet.

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.

INTERSECT ALL and EXCEPT ALL are parse errors

2 participants