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

Method asName

compiler/semantic/sql.go:190–205  ·  view source on GitHub ↗
(label *ast.ID, expr ast.Expr, path []string)

Source from the content-addressed store, hash-verified

188}
189
190func (t *translator) asName(label *ast.ID, expr ast.Expr, path []string) string {
191 var name string
192 if label != nil {
193 name = label.Name
194 if name == "" {
195 t.error(label, errors.New("column alias cannot be an empty string"))
196 }
197 } else if id, ok := expr.(*ast.IDExpr); ok && id.Name == "this" {
198 name = "that"
199 } else if path != nil {
200 name = path[len(path)-1]
201 } else {
202 name = deriveNameFromExpr(expr)
203 }
204 return name
205}
206
207func (t *translator) projection(columns []column, inType super.Type) {
208 for k := range columns {

Callers 1

formProjectionMethod · 0.95

Calls 3

deriveNameFromExprFunction · 0.85
NewMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected