MCPcopy
hub / github.com/uber/aresdb / isQueryFromMixed

Method isQueryFromMixed

query/sql/sql_parser.go:1783–1799  ·  view source on GitHub ↗

AQL requires that the first level query is either from tables or from subqueries/withQuery

(s2aCtx *SQL2AqlContext)

Source from the content-addressed store, hash-verified

1781
1782// AQL requires that the first level query is either from tables or from subqueries/withQuery
1783func (v *ASTBuilder) isQueryFromMixed(s2aCtx *SQL2AqlContext) (bool, error) {
1784 var flagTable bool
1785 var err error
1786 if len(s2aCtx.MapJoinTables[0][0].Table) != 0 {
1787 flagTable = true
1788 }
1789 for i, join := range s2aCtx.MapJoinTables[0] {
1790 if flagTable && len(join.Table) == 0 {
1791 err = fmt.Errorf("# %d should be a tablename in from clause", i)
1792 return true, err
1793 } else if !flagTable && len(join.Table) != 0 {
1794 err = fmt.Errorf("# %d should be a subquery/withQuery in from clause", i)
1795 return true, err
1796 }
1797 }
1798 return false, nil
1799}
1800
1801// AQL requires that all subqueries or withQuery from clauses are same
1802func (v *ASTBuilder) isSameFromTables(s2aCtx *SQL2AqlContext, mapKey int) (bool, error) {

Callers 1

isValidWithOrSubQueryMethod · 0.95

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected