diff --git a/project.clj b/project.clj index 666e4426448588c760e8725c9b91ee6ada8d20ea..7eca1755cfed6c2095c00a86b6ba104ee4d1d68d 100644 --- a/project.clj +++ b/project.clj @@ -88,7 +88,10 @@ :main ^:skip-aot metabase.core :manifest {"Liquibase-Package" "liquibase.change,liquibase.changelog,liquibase.database,liquibase.parser,liquibase.precondition,liquibase.datatype,liquibase.serializer,liquibase.sqlgenerator,liquibase.executor,liquibase.snapshot,liquibase.logging,liquibase.diff,liquibase.structure,liquibase.structurecompare,liquibase.lockservice,liquibase.sdk,liquibase.ext"} :target-path "target/%s" - :jvm-opts ["-server" ; Run JVM in server mode as opposed to client -- see http://stackoverflow.com/questions/198577/real-differences-between-java-server-and-java-client for a good explanation of this + :jvm-opts ["-XX:MaxPermSize=256m" ; give the JVM a little more PermGen space to avoid PermGen OutOfMemoryErrors + "-Xverify:none" ; disable bytecode verification when running in dev so it starts slightly faster + "-XX:+CMSClassUnloadingEnabled" ; let Clojure's dynamically generated temporary classes be GC'ed from PermGen + "-XX:+UseConcMarkSweepGC" ; Concurrent Mark Sweep GC needs to be used for Class Unloading (above) "-Djava.awt.headless=true"] ; prevent Java icon from randomly popping up in dock when running `lein ring server` :javac-options ["-target" "1.7", "-source" "1.7"] :uberjar-name "metabase.jar" @@ -122,10 +125,7 @@ :env {:mb-run-mode "dev"} :jvm-opts ["-Dlogfile.path=target/log" "-Xms1024m" ; give JVM a decent heap size to start with - "-Xmx2048m" ; hard limit of 2GB so we stop hitting the 4GB container limit on CircleCI - "-Xverify:none" ; disable bytecode verification when running in dev so it starts slightly faster - "-XX:+CMSClassUnloadingEnabled" ; let Clojure's dynamically generated temporary classes be GC'ed from PermGen - "-XX:+UseConcMarkSweepGC"] ; Concurrent Mark Sweep GC needs to be used for Class Unloading (above) + "-Xmx2048m"] ; hard limit of 2GB so we stop hitting the 4GB container limit on CircleCI :aot [metabase.logger]} ; Log appender class needs to be compiled for log4j to use it :reflection-warnings {:global-vars {*warn-on-reflection* true}} ; run `lein check-reflection-warnings` to check for reflection warnings :expectations {:injections [(require 'metabase.test-setup)] diff --git a/src/metabase/driver/postgres.clj b/src/metabase/driver/postgres.clj index 3e0351d501b704ec3fa486935530b0348b3cb046..320c22b8aca3206fbe7b5f43586a177af84d9022 100644 --- a/src/metabase/driver/postgres.clj +++ b/src/metabase/driver/postgres.clj @@ -114,8 +114,8 @@ :seconds (hsql/call :to_timestamp expr) :milliseconds (recur (hx// expr 1000) :seconds))) -(defn- date-trunc [unit expr] (hsql/call :date_trunc (hx/literal unit) expr)) -(defn- extract [unit expr] (hsql/call :extract unit expr)) +(defn- date-trunc [unit expr] (hsql/call :date_trunc (hx/literal unit) (hx/cast :timestamp expr))) +(defn- extract [unit expr] (hsql/call :extract unit (hx/cast :timestamp expr))) (def ^:private extract-integer (comp hx/->integer extract)) diff --git a/test/metabase/query_processor_test/filter_test.clj b/test/metabase/query_processor_test/filter_test.clj index 1061d553afb9f392d99fb7b6458051c5f892fd51..404115466401a966c31787b8288213f905f84c58 100644 --- a/test/metabase/query_processor_test/filter_test.clj +++ b/test/metabase/query_processor_test/filter_test.clj @@ -343,3 +343,11 @@ (ql/aggregation (ql/count)) (ql/filter (ql/and (ql/not (ql/> $id 32)) (ql/contains $name "BBQ"))))))) + + +;; make sure that filtering with dates truncating to minutes works (#4632) +(expect-with-non-timeseries-dbs [107] (first-row + (format-rows-by [int] + (data/run-query checkins + (ql/aggregation (ql/count)) + (ql/filter (ql/between (ql/datetime-field $date :minute) "2015-01-01T12:30:00" "2015-05-31"))))))