Skip to content

Commit f467628

Browse files
committed
Set CTE indirect on hierarchy objects for query rewriting
The CTE indirect from annotated AST was being retrieved but never set on the hierarchy objects. This caused from_rewrite.go to fail finding the indirect via GetTableMeta().GetIndirect(), resulting in empty results (0 rows) from CTE queries. Now the cteIndirect is properly set via hr.SetIndirect(cteIndirect) after creating the hierarchy objects for CTE references.
1 parent 897a1cd commit f467628

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

internal/stackql/router/parameter_router.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,9 @@ func (pr *standardParameterRouter) route(
602602
tableName := taxonomy.GetTableNameFromStatement(tb, pr.astFormatter)
603603
hIDs := internaldto.NewHeirarchyIdentifiers("", "", tableName, "")
604604
hr = tablemetadata.NewHeirarchyObjects(hIDs, isAwait)
605+
// Set the CTE indirect on the hierarchy objects so it can be accessed
606+
// during query rewriting and execution.
607+
hr.SetIndirect(cteIndirect)
605608
} else {
606609
hr, err = taxonomy.GetHeirarchyFromStatement(handlerCtx, tb, notOnParams, false, isAwait)
607610
if err != nil {

0 commit comments

Comments
 (0)