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

Query engine rewrite #1600

Merged
merged 17 commits into from
Mar 10, 2015
Merged

Query engine rewrite #1600

merged 17 commits into from
Mar 10, 2015

Conversation

pauldix
Copy link
Member

@pauldix pauldix commented Feb 13, 2015

This PR is for a refactor/rewrite of the query engine. There's no additional functionality, but this refactor will enable future work to fix the following:

I also aimed to simplify how the query engine worked. Instead of using channels to pass values from the map and reduce functions, they now just return values. This also makes it possible to do smaller sets of results at a time since the query engine can now manipulate how much data each call to the mapper will churn through.

I also pulled all of the stuff for defining functions into its own file. This should be the one place people look to when wiring up new query functions.

@pauldix pauldix self-assigned this Feb 20, 2015
@toddboom toddboom changed the title WIP: fix for ordering of queries of raw values Query engine rewrite Feb 27, 2015
@@ -600,6 +600,7 @@ func runTestsData(t *testing.T, testName string, nodes Cluster, database, retent
if name == "" {
name = tt.query
}
fmt.Printf("TEST: %d: %s\n", i, name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this deliberate? Seems like it just adds noise to the tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I had it so that if there's a failure and you're tracing through, you can find that test along with whatever output was coming out of the logs then. Was very helpful for me troubleshooting something.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid requirement, but you can get this with go test -v I believe -- it's what I do.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't, the problem is that test -v Doesn't put the test info inline with the actual output of the server. Basically, you get all the server output, and then at the end you get the test output. So it's impossible to see which maps with what. With this you see the info about the test running with the server output. Besides, this only shows up if you run with -v

for _, id := range m.seriesIDs {
seriesIdsToExpr[id] = nil
}
return seriesIdsToExpr
}
ids, _, _ := m.walkWhereForSeriesIds(stmt.Condition, seriesIdsToExpr)

// ids will be empty if all they had was a time in the where clause. so return all measurement series ids
if len(ids) == 0 && stmt.OnlyTimeDimensions() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -332,7 +369,7 @@ func (m *Measurement) idsForExpr(n *influxql.BinaryExpr) (seriesIDs, bool, influ
}

// ignore time literals
if _, ok := value.(*influxql.TimeLiteral); ok {
if _, ok := value.(*influxql.TimeLiteral); ok || name.Val == "time" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How could this happen? Either it's a TimeLiteral or not, right? Also doing a string-compare? Is that necessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they do a WHERE time > 1s then it ends up going to this. This is just during the planning phase of the query so a string compare isn't really that big of a deal.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should WHERE time = 'military' be a valid expression?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, that should return a parse error because that's not a valid time.

@pauldix
Copy link
Member Author

pauldix commented Mar 9, 2015

One thing I need to add to this are tests in server_integration_test.go to test min, max, count, mean, stddev, first, last, and percentile since I ripped out engine test. I'd prefer those tests to exist at that level anyway.

for _, k := range keys {
r.fn(k, data[k], e)
default:
// we shouldn't get here, but give them back nils if it goes this way
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quietly accepting stuff that shouldn't happen always makes me nervous. A panic might seem harsh, but if it shouldn't happen, shouldn't we find out?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather give back nils than panic.

@pauldix
Copy link
Member Author

pauldix commented Mar 10, 2015

Going to live dangerously and merge this in. Please continue to review and I'll update based on feedback in a new PR. Need to get the fixes this adds out in an RC tonight for some testing.

pauldix added a commit that referenced this pull request Mar 10, 2015
@pauldix pauldix merged commit 0f98a60 into master Mar 10, 2015
@toddboom toddboom deleted the fix-raw-ordering branch May 5, 2015 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants