         ]
       }
 
-  describe "different sorting works", ->
-    it "split Color; apply Revenue; combine Revenue, descending", testEquality {
-        drivers: ['simpleCached', 'simple']
-        query: [
-          { operation: 'split', name: 'Color', bucket: 'identity', attribute: 'color' }
-          { operation: 'apply', name: 'Revenue', aggregate: 'sum', attribute: 'price' }
-          { operation: 'combine', combine: 'slice', sort: { compare: 'natural', prop: 'Revenue', direction: 'descending' }, limit: 5 }
-        ]
-      }
-
-    it "split Color; apply Revenue; combine Revenue, ascending", testEquality {
-        drivers: ['simpleCached', 'simple']
-        query: [
-          { operation: 'split', name: 'Color', bucket: 'identity', attribute: 'color' }
-          { operation: 'apply', name: 'Revenue', aggregate: 'sum', attribute: 'price' }
-          { operation: 'combine', combine: 'slice', sort: { compare: 'natural', prop: 'Revenue', direction: 'ascending' }, limit: 5 }
-        ]
-      }
-
-    it "split Color; apply Revenue; combine Color, descending", testEquality {
-        drivers: ['simpleCached', 'simple']
-        query: [
-          { operation: 'split', name: 'Color', bucket: 'identity', attribute: 'color' }
-          { operation: 'apply', name: 'Revenue', aggregate: 'sum', attribute: 'price' }
-          { operation: 'combine', combine: 'slice', sort: { compare: 'natural', prop: 'Color', direction: 'descending' }, limit: 5 }
-        ]
-      }
-
-    it "split Color; apply Revenue; combine Color, ascending", testEquality {
-        drivers: ['simpleCached', 'simple']
-        query: [
-          { operation: 'split', name: 'Color', bucket: 'identity', attribute: 'color' }
-          { operation: 'apply', name: 'Revenue', aggregate: 'sum', attribute: 'price' }
-          { operation: 'combine', combine: 'slice', sort: { compare: 'natural', prop: 'Color', direction: 'ascending' }, limit: 5 }
-        ]
-      }
-
-
-  # Cache Test
-  describe "split time; apply count; apply added", ->
-    setUpQuery = [
-        { operation: 'filter', type:'within', attribute:'time', range: [ new Date(Date.UTC(2013, 2-1, 26, 0, 0, 0)), new Date(Date.UTC(2013, 2-1, 27, 0, 0, 0))] }
-        { operation: 'split', name: 'Time', bucket: 'timePeriod', attribute: 'time', period: 'PT1H', timezone: 'Etc/UTC' }
-        { operation: 'apply', name: 'Count', aggregate: 'sum', attribute: 'count' }
-        { operation: 'apply', name: 'Added', aggregate: 'sum', attribute: 'added' }
-        { operation: 'combine', combine: 'slice', sort: { compare: 'natural', prop: 'Time', direction: 'ascending' } }
-      ]
-
-    before (done) ->
-      driverFns.mySqlCached({query: setUpQuery}, (err, result) ->
-        throw err if err?
-        allowQuery = false
-        done()
-        return
-      )
-
-    after -> allowQuery = true
-
-    it "split time; apply count", testEquality {
-        drivers: ['mySqlCached', 'mySql']
-        query: [
+    describe "different sorting", ->
+      before -> allowQuery = true
+
+      it "split Color; apply Revenue; combine Revenue, descending", testEquality {
+          drivers: ['simpleCached', 'simple']
+          query: [
+            { operation: 'split', name: 'Color', bucket: 'identity', attribute: 'color' }
+            { operation: 'apply', name: 'Revenue', aggregate: 'sum', attribute: 'price' }
+            { operation: 'combine', combine: 'slice', sort: { compare: 'natural', prop: 'Revenue', direction: 'descending' }, limit: 5 }
+          ]
+        }
+
+      it "split Color; apply Revenue; combine Revenue, ascending", testEquality {
+          drivers: ['simpleCached', 'simple']
+          query: [
+            { operation: 'split', name: 'Color', bucket: 'identity', attribute: 'color' }
+            { operation: 'apply', name: 'Revenue', aggregate: 'sum', attribute: 'price' }
+            { operation: 'combine', combine: 'slice', sort: { compare: 'natural', prop: 'Revenue', direction: 'ascending' }, limit: 5 }
+          ]
+        }
+
+      it "split Color; apply Revenue; combine Color, descending", testEquality {
+          drivers: ['simpleCached', 'simple']
+          query: [
+            { operation: 'split', name: 'Color', bucket: 'identity', attribute: 'color' }
+            { operation: 'apply', name: 'Revenue', aggregate: 'sum', attribute: 'price' }
+            { operation: 'combine', combine: 'slice', sort: { compare: 'natural', prop: 'Color', direction: 'descending' }, limit: 5 }
+          ]
+        }
+
+      it "split Color; apply Revenue; combine Color, ascending", testEquality {
+          drivers: ['simpleCached', 'simple']
+          query: [
+            { operation: 'split', name: 'Color', bucket: 'identity', attribute: 'color' }
+            { operation: 'apply', name: 'Revenue', aggregate: 'sum', attribute: 'price' }
+            { operation: 'combine', combine: 'slice', sort: { compare: 'natural', prop: 'Color', direction: 'ascending' }, limit: 5 }
+          ]
+        }
+
+
+  describe "timeseries cache", ->
+    describe "without filters", ->
+      setUpQuery = [
           { operation: 'filter', type:'within', attribute:'time', range: [ new Date(Date.UTC(2013, 2-1, 26, 0, 0, 0)), new Date(Date.UTC(2013, 2-1, 27, 0, 0, 0))] }
           { operation: 'split', name: 'Time', bucket: 'timePeriod', attribute: 'time', period: 'PT1H', timezone: 'Etc/UTC' }
           { operation: 'apply', name: 'Count', aggregate: 'sum', attribute: 'count' }
+          { operation: 'apply', name: 'Added', aggregate: 'sum', attribute: 'added' }
           { operation: 'combine', combine: 'slice', sort: { compare: 'natural', prop: 'Time', direction: 'ascending' } }
         ]
-      }
-
-    it "split time; apply count; combine not by time", testEquality {
-        drivers: ['mySqlCached', 'mySql']
-        query: [
-          { operation: 'filter', type:'within', attribute:'time', range: [ new Date(Date.UTC(2013, 2-1, 26, 0, 0, 0)), new Date(Date.UTC(2013, 2-1, 27, 0, 0, 0))] }
-          { operation: 'split', name: 'Time', bucket: 'timePeriod', attribute: 'time', period: 'PT1H', timezone: 'Etc/UTC' }
-          { operation: 'apply', name: 'Count', aggregate: 'sum', attribute: 'count' }
-          { operation: 'combine', combine: 'slice', sort: { compare: 'natural', prop: 'Count', direction: 'ascending' } }
-        ]
-      }
-
-    it "split time; apply count; filter within another time filter", testEquality {
-        drivers: ['mySqlCached', 'mySql']
-        query: [
-          { operation: 'filter', type:'within', attribute:'time', range: [ new Date(Date.UTC(2013, 2-1, 26, 0, 0, 0)), new Date(Date.UTC(2013, 2-1, 26, 12, 0, 0))] }
-          { operation: 'split', name: 'Time', bucket: 'timePeriod', attribute: 'time', period: 'PT1H', timezone: 'Etc/UTC' }
-          { operation: 'apply', name: 'Count', aggregate: 'sum', attribute: 'count' }
-          { operation: 'combine', combine: 'slice', sort: { compare: 'natural', prop: 'Time', direction: 'ascending' } }
-        ]
-      }
-
-    it "split time; apply count; limit", testEquality {
-        drivers: ['mySqlCached', 'mySql']
-        query: [
-          { operation: 'filter', type:'within', attribute:'time', range: [ new Date(Date.UTC(2013, 2-1, 26, 0, 0, 0)), new Date(Date.UTC(2013, 2-1, 27, 0, 0, 0))] }
-          { operation: 'split', name: 'Time', bucket: 'timePeriod', attribute: 'time', period: 'PT1H', timezone: 'Etc/UTC' }
-          { operation: 'apply', name: 'Count', aggregate: 'sum', attribute: 'count' }
-          { operation: 'combine', combine: 'slice', sort: { compare: 'natural', prop: 'Time', direction: 'ascending' }, limit: 5 }
-        ]
-      }
-
-
-    # Cache Test 2
-  describe "filter one thing; split time; apply count; apply added", ->
-    setUpQuery = [
-        { operation: 'filter', type: 'and', filters: [
-          { operation: 'filter', attribute: 'language', type: 'is', value: 'en' }
-          { operation: 'filter', type:'within', attribute:'time', range: [ new Date(Date.UTC(2013, 2-1, 26, 0, 0, 0)), new Date(Date.UTC(2013, 2-1, 27, 0, 0, 0))] }
-        ]}
-        { operation: 'split', name: 'Time', bucket: 'timePeriod', attribute: 'time', period: 'PT1H', timezone: 'Etc/UTC' }
-        { operation: 'apply', name: 'Count', aggregate: 'sum', attribute: 'count' }
-        { operation: 'apply', name: 'Added', aggregate: 'sum', attribute: 'added' }
-        { operation: 'combine', combine: 'slice', sort: { compare: 'natural', prop: 'Time', direction: 'ascending' } }
-      ]
-
-    before (done) ->
-      driverFns.mySqlCached({query: setUpQuery}, (err, result) ->
-        throw err if err?
-        allowQuery = false
-        done()
-        return
-      )
-
-    after -> allowQuery = true
-
-    it "filter; split time; apply count; apply added", testEquality {
-        drivers: ['mySqlCached', 'mySql']
-        query: [
+
+      before (done) ->
+        driverFns.mySqlCached({query: setUpQuery}, (err, result) ->
+          throw err if err?
+          allowQuery = false
+          done()
+          return
+        )
+
+      after -> allowQuery = true
+
+      it "split time; apply count", testEquality {
+          drivers: ['mySqlCached', 'mySql']
+          query: [
+            { operation: 'filter', type:'within', attribute:'time', range: [ new Date(Date.UTC(2013, 2-1, 26, 0, 0, 0)), new Date(Date.UTC(2013, 2-1, 27, 0, 0, 0))] }
+            { operation: 'split', name: 'Time', bucket: 'timePeriod', attribute: 'time', period: 'PT1H', timezone: 'Etc/UTC' }
+            { operation: 'apply', name: 'Count', aggregate: 'sum', attribute: 'count' }
+            { operation: 'combine', combine: 'slice', sort: { compare: 'natural', prop: 'Time', direction: 'ascending' } }
+          ]
+        }
+
+      it "split time; apply count; combine not by time", testEquality {
+          drivers: ['mySqlCached', 'mySql']
+          query: [
+            { operation: 'filter', type:'within', attribute:'time', range: [ new Date(Date.UTC(2013, 2-1, 26, 0, 0, 0)), new Date(Date.UTC(2013, 2-1, 27, 0, 0, 0))] }
+            { operation: 'split', name: 'Time', bucket: 'timePeriod', attribute: 'time', period: 'PT1H', timezone: 'Etc/UTC' }
+            { operation: 'apply', name: 'Count', aggregate: 'sum', attribute: 'count' }
+            { operation: 'combine', combine: 'slice', sort: { compare: 'natural', prop: 'Count', direction: 'ascending' } }
+          ]
+        }
+
+      it "split time; apply count; filter within another time filter", testEquality {
+          drivers: ['mySqlCached', 'mySql']
+          query: [
+            { operation: 'filter', type:'within', attribute:'time', range: [ new Date(Date.UTC(2013, 2-1, 26, 0, 0, 0)), new Date(Date.UTC(2013, 2-1, 26, 12, 0, 0))] }
+            { operation: 'split', name: 'Time', bucket: 'timePeriod', attribute: 'time', period: 'PT1H', timezone: 'Etc/UTC' }
+            { operation: 'apply', name: 'Count', aggregate: 'sum', attribute: 'count' }
+            { operation: 'combine', combine: 'slice', sort: { compare: 'natural', prop: 'Time', direction: 'ascending' } }
+          ]
+        }
+
+      it "split time; apply count; limit", testEquality {
+          drivers: ['mySqlCached', 'mySql']
+          query: [
+            { operation: 'filter', type:'within', attribute:'time', range: [ new Date(Date.UTC(2013, 2-1, 26, 0, 0, 0)), new Date(Date.UTC(2013, 2-1, 27, 0, 0, 0))] }
+            { operation: 'split', name: 'Time', bucket: 'timePeriod', attribute: 'time', period: 'PT1H', timezone: 'Etc/UTC' }
+            { operation: 'apply', name: 'Count', aggregate: 'sum', attribute: 'count' }
+            { operation: 'combine', combine: 'slice', sort: { compare: 'natural', prop: 'Time', direction: 'ascending' }, limit: 5 }
+          ]
+        }
+
+
+    describe "filtered on one thing", ->
+      setUpQuery = [
           { operation: 'filter', type: 'and', filters: [
             { operation: 'filter', attribute: 'language', type: 'is', value: 'en' }
             { operation: 'filter', type:'within', attribute:'time', range: [ new Date(Date.UTC(2013, 2-1, 26, 0, 0, 0)), new Date(Date.UTC(2013, 2-1, 27, 0, 0, 0))] }


    after -> allowQuery = true

    describe "filter; split time; apply count; apply added; combine time descending", ->
      testQuery = [
        { operation: 'filter', type: 'and', filters: [
          { operation: 'filter', attribute: 'language', type: 'is', value: 'en' }
          { operation: 'filter', type:'within', attribute:'time', range: [ new Date(Date.UTC(2013, 2-1, 26, 0, 0, 0)), new Date(Date.UTC(2013, 2-1, 27, 0, 0, 0))] }
        ]}
        { operation: 'apply', name: 'Count', aggregate: 'sum', attribute: 'count' }
        { operation: 'apply', name: 'Added', aggregate: 'sum', attribute: 'added' }
      ]

      it "should have the same results for different drivers", testEquality {
        drivers: ['mySqlCached', 'mySql']
        query: testQuery
      }

  describe "doesn't query for known data", ->
    setUpQuery = [
      { operation: 'filter', type:'within', attribute:'time', range: [ new Date(Date.UTC(2013, 2-1, 26, 0, 0, 0)), new Date(Date.UTC(2013, 2-1, 27, 0, 0, 0))] }
      { operation: 'split', name: 'Language', bucket: 'identity', attribute: 'language' }

        ]
      }

  describe "filtered splits cache", ->
    setUpQuery = [
      { operation: 'split', name: 'Color', bucket: 'identity', attribute: 'color' }
      { operation: 'apply', name: 'Revenue', aggregate: 'sum', attribute: 'price' }
