skydb/sky — pull request #127 by benbjohnson (2013-08-29 01:24:37+00:00)
Title: Fix duplicate merge path bug.

This is a fix for something that was previously an edge case but is now more common with the introduction of variable and temporal loops.

Previously, if you had 10 events and ran this:

```
SELECT count() AS count
SELECT count() AS count
SELECT count() AS count
```

Then you'd get:

```
{"count":30}
```

This is because Sky generated merges for `count` with each selection which essentially sums it 3 times. With this PR, you now accurately get:

```
{"count":10}
```

It will only use the first merge so you could get fucked up results if you try combining aggregation functions for the same field:

```
SELECT count() AS count
SELECT sum(price) AS count
```

But you're a moron if you're running that code so don't do it. :)

However, this will still accurately work if you were selecting into different fields:

```
SELECT count() AS count
SELECT sum(price) AS sum
```