Skip to content

[main/v1] partiql-ast: modeling of s_f_w.set_op does not allow for left associative set operations #1507

Closed
@alancai98

Description

@alancai98

Description

  • Currently in the main and v1 branches, the ast's modeling of set_op.s_f_w does not allow for defining left associative set operations (UNION, EXCEPT, INTERSECT).

Current modeling on main/v1:

// The PartiQL `<sfw>` query expression, think SQL `<query specification>`
s_f_w::{
select: select, // oneof SELECT / SELECT VALUE / PIVOT
exclude: optional::exclude,
from: from,
let: optional::let,
where: optional::expr,
group_by: optional::group_by,
having: optional::expr,
set_op: optional::{
type: '.set_op',
operand: '.expr.s_f_w',
},
order_by: optional::order_by,
limit: optional::expr,
offset: optional::expr,
},

Assuming SFW_1, SFW_2, SFW_3 represent 3 different SFW queries. Then the following cannot be modeled in the current AST using set_op.s_f_w:

(SFW_1 EXCEPT SFW_2) EXCEPT SFW_3

Set operations are by default left-associative, so SFW_1 <set_op> SFW_2 <set_op> SFW_3 is also not representable.

To Reproduce

Steps to reproduce the behavior:

  1. Attempt to create the above query using the AST

Expected Behavior

  • Allow users + library owner to create a left associative set operation

Additional Context

  • Java version: 17
  • PartiQL version: 0.14.5 and later + v1 branch
  • Add any other context about the problem here.

Metadata

Metadata

Assignees

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