Fixes the dim time where clause interval queries.

- Changes the interval queries on dim time columns from <= ? and > ? to < ? and >= ?.
  This is more convinient for specifying where clause datetime values.
pull/1/head
Abhinav Sarkar 7 years ago
parent 064524f298
commit aede5d6fc6
  1. 4
      src/Ringo/Generator/Populate/Dimension.hs
  2. 2
      src/Ringo/Generator/Populate/Fact.hs

@ -32,7 +32,7 @@ dimensionTablePopulateSQL popMode fact dimTableName = do
baseWhereCs = [ "(\n"
<> Text.intercalate "\nOR " [ c <> " IS NOT NULL" | (_, c) <- colMapping ]
<> "\n)"
, timeCol <> " <= ?"
, timeCol <> " < ?"
]
insertC selectC whereCs =
@ -46,7 +46,7 @@ dimensionTablePopulateSQL popMode fact dimTableName = do
return $ case popMode of
FullPopulation -> insertC baseSelectC baseWhereCs
IncrementalPopulation ->
insertC baseSelectC (baseWhereCs ++ [ timeCol <> " > ?" ])
insertC baseSelectC (baseWhereCs ++ [ timeCol <> " >= ?" ])
<> "\nLEFT JOIN " <> dimTableName <> " ON\n"
<> Text.intercalate " \nAND "
[ fullColumnName dimTableName c1 <> " = " <> fullColumnName "x" c2

@ -195,7 +195,7 @@ factTablePopulateSQL popMode fact = do
, ftpsSelectTable = fTableName
, ftpsJoinClauses = joinClauses
, ftpsWhereClauses =
timeCol <> " <= ?" : [ timeCol <> " > ?" | popMode == IncrementalPopulation ]
timeCol <> " < ?" : [ timeCol <> " >= ?" | popMode == IncrementalPopulation ]
, ftpsGroupByCols = map ((groupByColPrefix <>) . fst3) . filter thd3 $ colMap
}

Loading…
Cancel
Save