Schema of selectScope is... {in: ,out: } for non-grouped {g:{k0,k1,...,a0,a1,...},out: } for grouped
| 64 | // {in:<input>,out:<projection>} for non-grouped |
| 65 | // {g:{k0,k1,...,a0,a1,...},out:<projection>} for grouped |
| 66 | selectScope struct { |
| 67 | in relScope |
| 68 | |
| 69 | // aggOk set when it's ok to process agg functions in expressions |
| 70 | aggOk bool |
| 71 | |
| 72 | // grouped is set when processing an expression that should resolve |
| 73 | // "this" to the aggregate projection (i.e., "g" column) |
| 74 | grouped bool |
| 75 | |
| 76 | // aggs is the set of agg functions computed in a grouped table |
| 77 | // inclusive of agg functions used subsequently in an order by |
| 78 | aggs []*sem.AggFunc |
| 79 | aggTypes []super.Type |
| 80 | |
| 81 | // groupings holds the grouping expressions which are needed to do |
| 82 | // expression matching for having, order by, and the projection. |
| 83 | // These expressions are always relative to the "in" scope. |
| 84 | // The grouped field true when resolution has access only to the outputs. |
| 85 | groupings []exprloc |
| 86 | |
| 87 | // groupByLoc is set when invoking t.expr() from an ordinal reference |
| 88 | // so that we can produce a more understandable error message. |
| 89 | groupByLoc ast.Node |
| 90 | |
| 91 | // Columns holds the projection. We bookkeep both the ast expression |
| 92 | // and sem tree expr so we can do lateral column alias macro substition. |
| 93 | // The lateral field is true when lateral column resolution is allowed |
| 94 | // during the analysis GROUP BY expressions. |
| 95 | columns []column |
| 96 | lateral bool |
| 97 | |
| 98 | // The output table is always static, e.g., a dynamic input is |
| 99 | // always wrapped in a column. Also, the projected columns referenced |
| 100 | // in ORDER BY have precedence over the rest of the SELECT expressions |
| 101 | // (in contrast to the rest of the SELECT body, where lateral column |
| 102 | // aliases have lwoer precedecne). |
| 103 | out *staticTable |
| 104 | } |
| 105 | |
| 106 | staticTable struct { |
| 107 | table string |
nothing calls this directly
no outgoing calls
no test coverage detected