From abdeaecb15b12cc2a388ca6cf0656b8f5b6b6bb0 Mon Sep 17 00:00:00 2001 From: Alan Cai Date: Mon, 15 Jul 2024 11:11:23 -0700 Subject: [PATCH] Add err messages; use nil --- .../planner/internal/transforms/RelConverter.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RelConverter.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RelConverter.kt index c5e2d10e4..9d6fe42a2 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RelConverter.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RelConverter.kt @@ -164,8 +164,14 @@ internal object RelConverter { override fun visitExprBagOp(node: Expr.BagOp, ctx: Rel): Rel { // Assumes parser correctly only allows Expr.SFW or other Expr.BagOps with Expr.SFW arguments when // converting to the SQL set op - assert(node.lhs is Expr.SFW || node.lhs is Expr.BagOp) - assert(node.rhs is Expr.SFW || node.rhs is Expr.BagOp) + assert(node.lhs is Expr.SFW || node.lhs is Expr.BagOp) { + "Expect LHS of bag op to be a Expr.SFW or a Expr.BagOp. " + + "However, it is ${node.lhs}." + } + assert(node.rhs is Expr.SFW || node.rhs is Expr.BagOp) { + "Expect RHS of bag op to be a Expr.SFW or a Expr.BagOp. " + + "However, it is ${node.lhs}." + } val setq = when (node.type.setq) { SetQuantifier.ALL -> org.partiql.planner.internal.ir.SetQuantifier.ALL null, SetQuantifier.DISTINCT -> org.partiql.planner.internal.ir.SetQuantifier.DISTINCT @@ -178,7 +184,7 @@ internal object RelConverter { SetOp.Type.INTERSECT -> Rel.Op.Intersect(setq, lhsRel, rhsRel) } return Rel( - type = Rel.Type(listOf(Rel.Binding("_0", StaticType.ANY)), props = emptySet()), + type = nil.type, op = op ) }