     splitOp = condensedQuery[1].split
 
     if splitOp.bucket in ['timePeriod', 'timeDuration']
-      { filter: oldFilter } = @_separateTimeFilter(oldFilter)
+      { filter: oldFilter } = separateTimeFilter(oldFilter)
       newFilterPiece = {
         attribute: splitOp.attribute
         type: 'within'




class SplitCache extends Cache
  # { key: filter,
  #   value: { key: split,
  #            value: [list of dimension values] } }

  get: (condensedQuery) ->
    # Return format:

# -----------------------------------------------------
driverUtil = require('./driverUtil')

filterToHash = (filter) ->
  return '' unless filter?
  hash = []
  if filter.filters?
    for subFilter in filter.filters
      hash.push filterToHash(subFilter)
    return hash.sort().join(filter.type)
  else
    for k, v of filter
      hash.push(k + ":" + v)
  return hash.sort().join('|')

splitToHash = (split) ->
  hash = []
  for k, v of split
    continue if k is 'name'
    hash.push(k + ":" + v)

  return hash.sort().join('|')

generateHash = (condensedQuery) ->
  # Get Filter and Split
  split = condensedQuery[1].split
  filter = condensedQuery[0].filter
  return filterToHash(filter) + '&' + splitToHash(split)

separateTimeFilter = (filter) ->
  if filter.filters?
    timeFilter = filter.filters.filter((({type}) -> type is 'within'), this)[0]
    filtersWithoutTime = filter.filters.filter((({type}) -> type is 'within'), this)
    if filtersWithoutTime.length is 1
      return {
        filter: filtersWithoutTime[0]
        timeFilter
      }
    else
      filter.filters = filtersWithoutTime
      return {
        filter: {
          operation: 'filter'
          type: 'and'
          filters: filtersWithoutTime
        }
        timeFilter
      }
  else # Only time filter exists
    return {
      filter: null
      timeFilter: filter
    }


class FilterCache
  # { key: filter,
  #   value: { key: metric,
  #            value: value } }
  constructor: ->
    @hashmap = {}

  get: (condensedQuery, values) ->
    # Return format:
