MCPcopy Create free account
hub / github.com/uber/aresdb / isMeasureInMain

Method isMeasureInMain

query/sql/sql_parser.go:1594–1612  ·  view source on GitHub ↗

isMeasureInMain check a measure of subquery/withQuery is also a measure of level 0 query return the index of the measure in level 0 query; otherwise return -1

(key, index int)

Source from the content-addressed store, hash-verified

1592// isMeasureInMain check a measure of subquery/withQuery is also a measure of level 0 query
1593// return the index of the measure in level 0 query; otherwise return -1
1594func (v *ASTBuilder) isMeasureInMain(key, index int) int {
1595 if len(v.SQL2AqlCtx.MapMeasures[key][index].Alias) != 0 {
1596 for i, measure := range v.SQL2AqlCtx.MapMeasures[0] {
1597 if measure.Expr == v.SQL2AqlCtx.MapMeasures[key][index].Alias {
1598 v.SQL2AqlCtx.MapMeasures[0][i].Expr = v.SQL2AqlCtx.MapMeasures[key][index].Expr
1599 v.SQL2AqlCtx.MapMeasures[0][i].Alias = v.SQL2AqlCtx.MapMeasures[key][index].Alias
1600 return i
1601 }
1602 }
1603 } else {
1604 for i, measure := range v.SQL2AqlCtx.MapMeasures[0] {
1605 if measure.Expr == v.SQL2AqlCtx.MapMeasures[key][index].Expr {
1606 return i
1607 }
1608 }
1609 }
1610
1611 return -1
1612}
1613
1614// GetAQL construct AQLQuery via read through SQL2AqlCtx
1615func (v *ASTBuilder) GetAQL() *queryCom.AQLQuery {

Callers 1

mergeWithOrSubQueryMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected