MCPcopy Create free account
hub / github.com/brimdata/super / inferSchema

Method inferSchema

compiler/semantic/sql.go:345–352  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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).
345func (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
354func (t *translator) genDistinct(e sem.Expr, seq sem.Seq) sem.Seq {
355 return append(seq, &sem.DistinctOp{

Callers 1

sqlValuesMethod · 0.95

Calls 4

TypeUnderFunction · 0.92
NewMethod · 0.80
fuseMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected