-
- Downloads
Effective type in result cols (#17533)
* Include the results base type as the cols effective type previously was merged the effective type from the col which caused issues with dates when selecting a particular temporal unit, ie month. Queries like this return months as integers so the base and effective types are :type/Integer, and something somewhere else is responsible for the unit conversion of `1` to January (or feb, months get weird i think) ```clojure ;; after {:description "The date and time an order was submitted.", :unit :month-of-year, :name "CREATED_AT", :field_ref [:field 4 {:temporal-unit :month-of-year}], :effective_type :type/Integer, ;; we have the proper effective type :display_name "Created At", :base_type :type/Integer} ;; before: {:description "The date and time an order was submitted.", :unit :month-of-year, :name "CREATED_AT", :field_ref [:field 4 {:temporal-unit :month-of-year}], :effective_type :type/DateTime, ;; included effective type from db :display_name "Created At", :base_type :type/Integer} ``` * tests * Driver tests * Ignore effective/base types in breakout tests sparksql is weird and its totally unrelated to the file under test * Use correct options for datetimes that are projected to month, etc When aggregating by a datetime column, you can choose a unit: month, hour-of-day, week, etc. You often (always?) end up with an integer. Previously the base_type was (inexplicably) :type/Integer and the effective_type was :type/DateTime which really just didn't make sense. The ideal solution is :type/DateTime as the base_type and :type/Integer as the effective_type. But this breaks the frontend as it expects to treat these columns in a special way. But it expected them to report as date columns. I've changed it only here. I thought about making isDate understand the `column.unit` attribute and recognize that these are in fact dates, but that seems wrong. These are integers that are special cases. It seems that the contexts that need to talk about dates should understand integers in a special way than all date code needs to be aware that integers might flow through. This might mean extra work but ultimately feels better as the correct solution. * unit is not default
Showing
- frontend/src/metabase/visualizations/lib/settings/column.js 1 addition, 1 deletionfrontend/src/metabase/visualizations/lib/settings/column.js
- modules/drivers/bigquery-cloud-sdk/test/metabase/driver/bigquery_cloud_sdk/query_processor_test.clj 3 additions, 0 deletions...tabase/driver/bigquery_cloud_sdk/query_processor_test.clj
- modules/drivers/bigquery/test/metabase/driver/bigquery/query_processor_test.clj 3 additions, 0 deletions...ry/test/metabase/driver/bigquery/query_processor_test.clj
- modules/drivers/druid/test/metabase/driver/druid/query_processor_test.clj 6 additions, 1 deletion...druid/test/metabase/driver/druid/query_processor_test.clj
- modules/drivers/mongo/test/metabase/driver/mongo_test.clj 1 addition, 0 deletionsmodules/drivers/mongo/test/metabase/driver/mongo_test.clj
- src/metabase/query_processor/middleware/annotate.clj 8 additions, 1 deletionsrc/metabase/query_processor/middleware/annotate.clj
- test/metabase/api/card_test.clj 1 addition, 0 deletionstest/metabase/api/card_test.clj
- test/metabase/api/dataset_test.clj 1 addition, 0 deletionstest/metabase/api/dataset_test.clj
- test/metabase/api/table_test.clj 6 additions, 0 deletionstest/metabase/api/table_test.clj
- test/metabase/driver/h2_test.clj 2 additions, 0 deletionstest/metabase/driver/h2_test.clj
- test/metabase/driver/postgres_test.clj 1 addition, 0 deletionstest/metabase/driver/postgres_test.clj
- test/metabase/driver/sql_jdbc/native_test.clj 4 additions, 0 deletionstest/metabase/driver/sql_jdbc/native_test.clj
- test/metabase/query_processor/middleware/add_source_metadata_test.clj 6 additions, 2 deletions...e/query_processor/middleware/add_source_metadata_test.clj
- test/metabase/query_processor/middleware/annotate_test.clj 5 additions, 0 deletionstest/metabase/query_processor/middleware/annotate_test.clj
- test/metabase/query_processor/middleware/results_metadata_test.clj 10 additions, 1 deletion...base/query_processor/middleware/results_metadata_test.clj
- test/metabase/query_processor_test.clj 10 additions, 3 deletionstest/metabase/query_processor_test.clj
- test/metabase/query_processor_test/aggregation_test.clj 0 additions, 1 deletiontest/metabase/query_processor_test/aggregation_test.clj
- test/metabase/query_processor_test/breakout_test.clj 4 additions, 4 deletionstest/metabase/query_processor_test/breakout_test.clj
- test/metabase/query_processor_test/native_test.clj 2 additions, 1 deletiontest/metabase/query_processor_test/native_test.clj
- test/metabase/query_processor_test/nested_queries_test.clj 4 additions, 4 deletionstest/metabase/query_processor_test/nested_queries_test.clj
Loading
Please register or sign in to comment