-- | TPC-H Query Q4 (abstraction-heavy DSH style)
-- Compute the number of problematic orders per priority level.
q4 :: Day -> Q [(Text, Integer)]
q4 startDate =
    sortWith fst [ tup2 op (length g) | (view -> (op, g)) <- groupWithKey id oids]
  where
    interval = Interval startDate (C.addGregorianMonthsRollOver 3 startDate)
    oids     = problematicOrders interval

--------------------------------------------------------------------------------

-- | TPC-H Query Q4 (literal transcription with 'null')
q4 :: Day -> Q [(Text, Integer)]
q4 startDate =
    sortWith fst [ tup2 op (length g) | (view -> (op, g)) <- groupWithKey id oids]
  where
    interval = Interval startDate (C.addGregorianMonthsRollOver 3 startDate)
    oids     = problematicOrders interval

--------------------------------------------------------------------------------

-- | TPC-H Query Q4 (literal transcription with 'null')
q4 startDate =
    sortWith fst [ tup2 op (length g) | (view -> (op, g)) <- groupWithKey id oids]
  where
    interval = Interval startDate (C.addGregorianMonthsRollOver 3 startDate)
    oids     = problematicOrders interval

--------------------------------------------------------------------------------

-- | TPC-H Query Q4 (literal transcription with 'null')