From 50d252566e04260e35549703ca08be87319bc8f4 Mon Sep 17 00:00:00 2001 From: "Jonathan A. Sternberg" Date: Tue, 1 Nov 2016 15:54:43 -0500 Subject: [PATCH] Support the ON syntax in SHOW TAG VALUES The parser was updated previously in #7295 and the functionality was supposed to be there, but the wiring in the query engine for that to happen was never written. --- coordinator/statement_executor.go | 8 ++++++-- influxql/statement_rewriter.go | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/coordinator/statement_executor.go b/coordinator/statement_executor.go index 2bc334384a4..c4bc21cb440 100644 --- a/coordinator/statement_executor.go +++ b/coordinator/statement_executor.go @@ -857,11 +857,11 @@ func (e *StatementExecutor) executeShowSubscriptionsStatement(stmt *influxql.Sho } func (e *StatementExecutor) executeShowTagValues(q *influxql.ShowTagValuesStatement, ctx *influxql.ExecutionContext) error { - if ctx.Database == "" { + if q.Database == "" { return ErrDatabaseNameRequired } - tagValues, err := e.TSDBStore.TagValues(ctx.Database, q.Condition) + tagValues, err := e.TSDBStore.TagValues(q.Database, q.Condition) if err != nil { ctx.Results <- &influxql.Result{ StatementID: ctx.StatementID, @@ -1089,6 +1089,10 @@ func (e *StatementExecutor) NormalizeStatement(stmt influxql.Statement, defaultD if node.Database == "" { node.Database = defaultDatabase } + case *influxql.ShowTagValuesStatement: + if node.Database == "" { + node.Database = defaultDatabase + } case *influxql.Measurement: switch stmt.(type) { case *influxql.DropSeriesStatement, *influxql.DeleteSeriesStatement: diff --git a/influxql/statement_rewriter.go b/influxql/statement_rewriter.go index 3ca717b4dd1..ef2f6c39030 100644 --- a/influxql/statement_rewriter.go +++ b/influxql/statement_rewriter.go @@ -122,6 +122,7 @@ func rewriteShowTagValuesStatement(stmt *ShowTagValuesStatement) (Statement, err condition = rewriteSourcesCondition(stmt.Sources, condition) return &ShowTagValuesStatement{ + Database: stmt.Database, Op: stmt.Op, TagKeyExpr: stmt.TagKeyExpr, Condition: condition,