With type checking integrated into the SQL analysis, the logic here can always infer a staticTable. Eventually, this will need to support lateral join subqueries which have runtime values (but staticTable columns are still known).
(loc ast.Node, types []super.Type)
| 343 | // can always infer a staticTable. Eventually, this will need to support |
| 344 | // lateral join subqueries which have runtime values (but staticTable columns are still known). |
| 345 | func (t *translator) inferSchema(loc ast.Node, types []super.Type) *staticTable { |
| 346 | recType, ok := super.TypeUnder(t.checker.fuse(types)).(*super.TypeRecord) |
| 347 | if !ok { |
| 348 | t.error(loc, errors.New("VALUES clause must have records or tuples")) |
| 349 | return badTable |
| 350 | } |
| 351 | return &staticTable{typ: recType} |
| 352 | } |
| 353 | |
| 354 | func (t *translator) genDistinct(e sem.Expr, seq sem.Seq) sem.Seq { |
| 355 | return append(seq, &sem.DistinctOp{ |