Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queries for a missing measurement still result in a 500 when using GROUP BY * #1859

Merged
merged 2 commits into from
Mar 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/influxd/server_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,11 @@ func runTestsData(t *testing.T, testName string, nodes Cluster, database, retent
query: `select event from "%DB%"."%RP%".logs where event = 'nonsense'`,
expected: `{"results":[{}]}`,
},
{
name: "missing measurement with `GROUP BY *`",
query: `select load from "%DB%"."%RP%".missing group by *`,
expected: `{"results":[{"error":"measurement not found: \"mydb\".\"myrp\".\"missing\""}]}`,
},

// Metadata display tests

Expand Down
4 changes: 2 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1576,7 +1576,7 @@ func (s *Server) applyCreateMeasurementsIfNotExists(m *messaging.Message) error
// Create each new field.
mm := db.measurements[cm.Name]
if mm == nil {
panic(fmt.Sprintf("Measurement %s does not exist", cm.Name))
panic(fmt.Sprintf("measurement not found: %s", cm.Name))
}
for _, f := range cm.Fields {
if err := mm.createFieldIfNotExists(f.Name, f.Type); err != nil {
Expand Down Expand Up @@ -1873,7 +1873,7 @@ func (s *Server) rewriteSelectStatement(stmt *influxql.SelectStatement) (*influx

mm := s.databases[db].measurements[m]
if mm == nil {
return nil, fmt.Errorf("measurement %s does not exist.", measurement.Name)
return nil, fmt.Errorf("measurement not found: %s", measurement.Name)
}

for _, f := range mm.Fields {
Expand Down
2 changes: 1 addition & 1 deletion server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ func TestServer_DropMeasurementSeriesTagsPreserved(t *testing.T) {
}

results = s.ExecuteQuery(MustParseQuery(`SELECT * FROM cpu`), "foo", nil)
if res := results.Results[0]; res.Err.Error() != `measurement "foo"."raw"."cpu" does not exist.` {
if res := results.Results[0]; res.Err.Error() != `measurement not found: "foo"."raw"."cpu"` {
t.Fatalf("unexpected error: %s", res.Err)
} else if len(res.Series) != 0 {
t.Fatalf("unexpected row count: %d", len(res.Series))
Expand Down