// createTagSetsAndFields returns the tagsets and various fields given a measurement and // SELECT statement. func createTagSetsAndFields(c *Conversation, stmt *sql.SelectStatement) (*tagSetsAndFields, error) { _, tagKeys, err := stmt.Dimensions.Normalize() if err != nil { return nil, err } sfs := newStringSet() sts := newStringSet() wfs := newStringSet() // Validate the fields and tags asked for exist and keep track of which are in the select vs the where for _, n := range stmt.NamesInSelect() { if c.HasField(n) { sfs.add(n) continue } if c.HasTagKey(n) { sts.add(n) tagKeys = append(tagKeys, n) } } for _, n := range stmt.NamesInWhere() { if n == "time" { continue } if c.HasField(n) { wfs.add(n) continue } } // Get the sorted unique tag sets for this statement. // tagSets, err := c.TagSets(stmt, tagKeys) // if err != nil { // return nil, err // } return &tagSetsAndFields{ // tagSets: tagSets, selectFields: sfs.list(), selectTags: sts.list(), whereFields: wfs.list(), }, nil }