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

Refactor QueryExecutor #5663

Merged
merged 1 commit into from
Feb 17, 2016
Merged

Conversation

benbjohnson
Copy link
Contributor

Overview

This pull request moves QueryExecutor from the tsdb package to the influxql package and adds additional StatementExecutor interfaces for each statement type.

TODO

  • SET PASSWORD
  • SELECT INTO
  • Fix empty result returns
  • Fix meta test package

/cc @jwilder @dgnorton @joelegasse @e-dard

)

// NewQueryExecutor returns an instance of QueryExecutor with registered statement executors.
func NewQueryExecutor(mc *meta.Client, s *tsdb.Store, m *monitor.Monitor, pw *cluster.PointsWriter) *influxql.QueryExecutor {
Copy link
Member

Choose a reason for hiding this comment

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

PointsWriter not needed? Was confused why this was getting passed into a query executor

StatementNormalizer StatementNormalizer

// Rewrites statements into other statements, as needed.
StatementRewriter *StatementRewriter
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this exposed and a pointer, or even a named type? StatementRewriter is defined as an empty struct, and the (pointer) receiver value is never used, other than to call methods. This field should be taken out and non-exported functions should be used instead.

@benbjohnson
Copy link
Contributor Author

This PR is ready for review.

There is one outstanding issue where the monitor.Monitor depends on cluster.PointsWriter but now that the QueryExecutor exists in cluster it creates a circular dependency. I'm trying to figure out the simplest way to resolve that.

@jsternberg
Copy link
Contributor

Looks fine to me so far, but the sections that are commented out should either be fixed if they are needed or removed if they are no longer needed.

@benbjohnson
Copy link
Contributor Author

@jsternberg I implemented a smaller wrapper type for cluster.PointsWriter so it could be injected into monitor.Monitor in 9bebc2b. :shipit:?

} else if got, exp := len(res.Series), 1; got != exp {
t.Fatalf("unexpected response.\n\ngot: %d series\nexp: %d\n", got, exp)
}
// FIXME(benbjohnson): Convert to metadata reads.
Copy link
Contributor

Choose a reason for hiding this comment

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

FIXME

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Weird. I swear I removed these sections. This needs to be tested at the QueryExecutor level so I wasn't going to rewrite them here.

This commit moves the `QueryExecutor` to the `cluster` package
and provides an interface to it inside the `influxql` package.
@jwilder
Copy link
Contributor

jwilder commented Feb 17, 2016

👍

@e-dard
Copy link
Contributor

e-dard commented Feb 17, 2016

LGTM 👍

benbjohnson added a commit that referenced this pull request Feb 17, 2016
@benbjohnson benbjohnson merged commit eb221a5 into influxdata:master Feb 17, 2016
@benbjohnson benbjohnson deleted the query-executor branch February 17, 2016 23:30
@benbjohnson benbjohnson changed the title Refactor QueryExecutor (WIP) Refactor QueryExecutor Feb 17, 2016
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.

6 participants