[toy-model] Add the subq_path to the QIL
@@ -475,7 +475,7 @@ def eval_Select(node: qlast.SelectQuery, ctx: EvalContext) -> Result:
subqs = [node.where] + [x.path for x in orderby]
extra_subqs = [(subq_path, subq) for subq in subqs]
new_qil, out = subquery_full(node.result, extra_subqs=extra_subqs, ctx=ctx)
- new_qil += [(IPartial(),)]
+ new_qil += [simplify_path(subq_path) if subq_path else (IPartial(),)]
if node.result_alias:
out = [row + (row[-1],) for row in out]
new_qil += [(IORef(node.result_alias),)]
@@ -523,8 +523,7 @@ ANONYMOUS_SHAPE_EXPR = qlast.DetachedExpr(
def eval_Shape(node: qlast.Shape, ctx: EvalContext) -> Result:
subq_path = update_path(ctx.cur_path, node.expr)
- assert subq_path
- subq_ipath = simplify_path(subq_path)
+ subq_ipath = simplify_path(subq_path) if subq_path else (IPartial(),)
qil = ctx.query_input_list + [subq_ipath]
# XXX: do we need to do extra_subqs??
