(
qcx: &QueryContext,
table_factor: &TableFactor<Aug>,
)
| 2985 | } |
| 2986 | |
| 2987 | fn plan_table_factor( |
| 2988 | qcx: &QueryContext, |
| 2989 | table_factor: &TableFactor<Aug>, |
| 2990 | ) -> Result<(HirRelationExpr, Scope), PlanError> { |
| 2991 | match table_factor { |
| 2992 | TableFactor::Table { name, alias } => { |
| 2993 | let (expr, scope) = qcx.resolve_table_name(name.clone())?; |
| 2994 | let scope = plan_table_alias(scope, alias.as_ref())?; |
| 2995 | Ok((expr, scope)) |
| 2996 | } |
| 2997 | |
| 2998 | TableFactor::Function { |
| 2999 | function, |
| 3000 | alias, |
| 3001 | with_ordinality, |
| 3002 | } => plan_solitary_table_function(qcx, function, alias.as_ref(), *with_ordinality), |
| 3003 | |
| 3004 | TableFactor::RowsFrom { |
| 3005 | functions, |
| 3006 | alias, |
| 3007 | with_ordinality, |
| 3008 | } => plan_rows_from(qcx, functions, alias.as_ref(), *with_ordinality), |
| 3009 | |
| 3010 | TableFactor::Derived { |
| 3011 | lateral, |
| 3012 | subquery, |
| 3013 | alias, |
| 3014 | } => { |
| 3015 | let mut qcx = (*qcx).clone(); |
| 3016 | if !lateral { |
| 3017 | // Since this derived table was not marked as `LATERAL`, |
| 3018 | // make elements in outer scopes invisible until we reach the |
| 3019 | // next lateral barrier. |
| 3020 | for scope in &mut qcx.outer_scopes { |
| 3021 | if scope.lateral_barrier { |
| 3022 | break; |
| 3023 | } |
| 3024 | scope.items.clear(); |
| 3025 | } |
| 3026 | } |
| 3027 | qcx.outer_scopes[0].lateral_barrier = true; |
| 3028 | let (expr, scope) = plan_nested_query(&mut qcx, subquery)?; |
| 3029 | let scope = plan_table_alias(scope, alias.as_ref())?; |
| 3030 | Ok((expr, scope)) |
| 3031 | } |
| 3032 | |
| 3033 | TableFactor::NestedJoin { join, alias } => { |
| 3034 | let (expr, scope) = plan_table_with_joins(qcx, join)?; |
| 3035 | let scope = plan_table_alias(scope, alias.as_ref())?; |
| 3036 | Ok((expr, scope)) |
| 3037 | } |
| 3038 | } |
| 3039 | } |
| 3040 | |
| 3041 | /// Plans a `ROWS FROM` expression. |
| 3042 | /// |
no test coverage detected