Merge pull request #7561 from influxdata/js-7552-backport

Support the ON syntax in SHOW TAG VALUES
pull/7570/head
Jonathan A. Sternberg 2016-11-01 17:35:42 -05:00 committed by GitHub
commit e4e5edcbea
2 changed files with 7 additions and 2 deletions

View File

@ -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:

View File

@ -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,