influxdb/influxdb — pull request #1186 by benbjohnson (2014-11-30 23:08:51+00:00)
Title: [WIP] Query Planner

## Overview

This pull request adds a query planner for taking an `influxql.SelectStatement` and returning an `influxdb.Executor`. It implements a map-reduce style interface in order to help optimization across multiple cores and nodes.

_Note: This is a work-in-progress. Only a basic planner has been implemented so far._

## Implementation

The planner works by creating an executor for each series. The executor creates mappers and reducers for each field selected and then returns a channel where results are streamed out. The mappers generate sets of values for a given key (where "key" is a `GROUP BY` value) and then the reducers combine those sets for each key. The results are feed to the return channel for the caller to consume.

Multi-series plans will need to combine multiple executors and join their results before returning data to the channel.

## TODO

- [ ] `GROUP BY`
- [ ] `INNER JOIN`
- [ ] `MERGE`
- [ ] `WHERE`
- [ ] `ORDER BY`
- [ ] `LIMIT`

---

/cc @pauldix @toddboom