From 4f4bca73ab787e367b093a55817ed8384e056cff Mon Sep 17 00:00:00 2001 From: Igor Pojzl Date: Wed, 22 Apr 2020 12:46:43 +0200 Subject: [PATCH 1/2] fix End Date to be Inclusive --- src/metabase/driver/cubejs/query_processor.clj | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/metabase/driver/cubejs/query_processor.clj b/src/metabase/driver/cubejs/query_processor.clj index 41b11a2..7d92159 100644 --- a/src/metabase/driver/cubejs/query_processor.clj +++ b/src/metabase/driver/cubejs/query_processor.clj @@ -50,10 +50,12 @@ dts1))) (defn- lower-bound [unit t] - (:start (u.date/range t unit))) + (:start (u.date/range t unit ))) -(defn- upper-bound [unit t] - (:end (u.date/range t unit))) +(defn- upper-bound [unit t] + (:end (u.date/range t unit {:start :inclusive + :end :inclusive + :resolution :millisecond}))) (defn ^:private mbql-granularity->cubejs-granularity [granularity] @@ -109,7 +111,7 @@ (defmethod ->rvalue :relative-datetime [[_ amount unit]] [(u.date/format (u.date/truncate (lower-bound unit (u.date/add unit amount)) unit)) - (u.date/format (u.date/truncate (upper-bound unit (u.date/add unit amount)) unit))]) + (u.date/format (upper-bound unit (u.date/add unit amount)))]) (defmethod ->rvalue :absolute-datetime [[_ t]] From 80af26af7b2300c061faff6eb713b2029ccf17ca Mon Sep 17 00:00:00 2001 From: Igor Pojzl Date: Wed, 22 Apr 2020 12:47:31 +0200 Subject: [PATCH 2/2] Wrong Format. --- src/metabase/driver/cubejs/query_processor.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/metabase/driver/cubejs/query_processor.clj b/src/metabase/driver/cubejs/query_processor.clj index 7d92159..4f47a4e 100644 --- a/src/metabase/driver/cubejs/query_processor.clj +++ b/src/metabase/driver/cubejs/query_processor.clj @@ -50,7 +50,7 @@ dts1))) (defn- lower-bound [unit t] - (:start (u.date/range t unit ))) + (:start (u.date/range t unit))) (defn- upper-bound [unit t] (:end (u.date/range t unit {:start :inclusive