mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-26 01:40:36 +00:00
fix: wrap tql cte in a subquery alias (#6910)
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
@@ -282,6 +282,16 @@ impl DfLogicalPlanner {
|
||||
.build()
|
||||
.context(PlanSqlSnafu)?;
|
||||
}
|
||||
|
||||
// Wrap in SubqueryAlias to ensure proper table qualification for CTE
|
||||
logical_plan = LogicalPlan::SubqueryAlias(
|
||||
datafusion_expr::SubqueryAlias::try_new(
|
||||
Arc::new(logical_plan),
|
||||
cte.name.value.clone(),
|
||||
)
|
||||
.context(PlanSqlSnafu)?,
|
||||
);
|
||||
|
||||
planner_context.insert_cte(&cte.name.value, logical_plan);
|
||||
}
|
||||
CteContent::Sql(_) => {
|
||||
|
||||
Reference in New Issue
Block a user