Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Jul 04, 2023
  2. Jun 20, 2023
  3. Jun 12, 2023
  4. Jun 02, 2023
  5. May 24, 2023
  6. May 23, 2023
  7. May 19, 2023
  8. May 15, 2023
  9. May 11, 2023
  10. May 01, 2023
  11. Apr 19, 2023
    • Braden Shepherdson's avatar
      [MLv2] Change how `TemplateTag.widget-type` works for field filters (#30191) · 86688e10
      Braden Shepherdson authored
      The current state is a collection of hacks to preserve some legacy
      behavior (eg. normalization sets a blank `widget-type` to `"category"`)
      and it doesn't work properly right now.
      
      An example of a currently-broken case:
      - `SELECT * FROM Orders WHERE {{tag}}`
      - Set it to a Field Filter and select People > LONGITUDE
        - Or some other field for which type we don't have a widget.
      - It shows "None" as the widget type, and the widget isn't shown at the
        top.
      - Save the question and reopen it.
      - Now the widget is visible (and a bit broken) as a `"category"` type.
      
      This is because on reading from the appdb it gets normalized.
      
      This PR uses `"none"` properly for cases where there are no widget
      options for the field type (eg. longitude), and updates all the usage
      sites to properly handle `"none"` rather than missing/undefined.
      
      Existing saved questions with a blank `widget-type` will continue to
      "work" as they currently do.
      86688e10
    • Cam Saul's avatar
      Tree shake the backend code (#30214) · ae0d9c62
      Cam Saul authored
      ae0d9c62
  12. Apr 18, 2023
  13. Apr 11, 2023
    • Braden Shepherdson's avatar
      [MLv2] Drop non-standard normalization in QB selectors (#29830) · e0d5922e
      Braden Shepherdson authored
      Use the canonical `metabase.mbql.js/normalize` instead, with a bit of
      customization for the query builder's needs. In the long run this should
      be fully unified; for now at least the logic is inside MLv2 now.
      
      All the test cases from the existing code are still exercised between
      `selectors.unit.spec` and `metabase.mbql.js_test`.
      e0d5922e
  14. Mar 31, 2023
  15. Mar 30, 2023
  16. Mar 29, 2023
  17. Mar 28, 2023
  18. Mar 20, 2023
  19. Mar 13, 2023
  20. Mar 09, 2023
    • Cam Saul's avatar
      MLv2 metadata calculation (#28921) · be66142d
      Cam Saul authored
      * MLv2 metadata overhaul, second try
      
      * Stricter linting for MLv2
      
      * Address PR feedback
      
      * Revert fancy fn schema for now
      
      * Remove unused import
      
      * Test fixes :wrench:
      
      * Oops fix bad :require form
      
      * MLv2 mega metadata overhaul 2 of infinity
      
      * Test fixes
      
      * Cljc humanization
      
      * Misc MLv2 improvements from #28921
      
      * Fix indentation
      
      * expression.non-integer-real
      
      * Remove debugging stuff
      
      * More cleanup
      
      * Add method for `:advanced`
      
      * non-integer-real
      
      * Test fixes :wrench:
      
      * Test fixes: ::ref/field shouldn't fail if checked against a non-sequential object
      
      * MLv2 `define-mbql-clause` and `type-of` calculation
      
      * Continued [ci skip]
      
      * MLv2 overhaul :flex:
      
      * Address PR feedback
      
      * Merge type-of overhaul
      
      * Address PR feedback
      be66142d
    • Cam Saul's avatar
      MLv2 clause and type determination overhaul (#29070) · 473758e3
      Cam Saul authored
      * MLv2 `define-mbql-clause` and `type-of` calculation
      
      * Continued [ci skip]
      
      * MLv2 overhaul :flex:
      473758e3
  21. Feb 24, 2023
  22. Feb 21, 2023
    • john-metabase's avatar
      Improves consistency of substring in MBQL (#28067) · a39b710e
      john-metabase authored
      
      * Improves consistency of substring in MBQL
      
      Standard SQL SUBSTRING() uses a 1-based start index, with various drivers
      handling a 0 start index in different ways. To make the behavior of substring
      consistent across drivers, we will always convert a 0 start index in MBQL
      to a 1 in SQL. The ->honeysql implementation of substring has been generalized
      and drivers can now override just the name of the substring function, or the
      entire expression if necessary. SQL Server now calls the parent implementation.
      
      Resolves #12445
      
      * Fixes substring from 0 in Mongo
      
      * Adds arg to substring parent call
      
      * Fix docs and helper text for substring()
      
      * Adds schema to require positive integer index for substring
      
      * WIP, adds frontend validation for substring index arg
      
      * Adds frontend test for substring arg validation
      
      * Updates substring test to expect exception on index 0
      
      * Update src/metabase/driver/sql/query_processor.clj
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      
      * Use s/if instead of s/conditional
      
      * Fix substring call in mysql substring spec
      
      * Reverts driver and sql.qp changes for substring index
      
      * Reverts changes to dispatch-by-clause-name-or-class
      
      * Fixes typeinferencer test substring index
      
      * Adds test for canonicalizing substring
      
      * Fixes substring canonicalization with extra args
      
      * Updates string extracts test to account for substring canonicalization
      
      * Rewrites resolver validation application
      
      * Adds test case for frontend expression validation errors
      
      * Fixes frontend compiler spec for new substring validation
      
      ---------
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      a39b710e
  23. Feb 11, 2023
  24. Feb 10, 2023
  25. Feb 07, 2023
  26. Jan 26, 2023
  27. Jan 13, 2023
    • Braden Shepherdson's avatar
      [metabase-lib] Number and currency formatting polish (#27616) · e7e422cf
      Braden Shepherdson authored
      - Use currency-specific decimals count (eg. 0 for JPY, 8 for BTC)
      - Use plural currency names in Java, matching JS
          - previously: singular proper name "7.23 US Dollar"
          - now: plural prose "7.23 US dollars"
      - "Small numbers" hack to treat min/max fraction digits as significant
        digits now applies to percentages under 1%, as well as the original
        |n| < 1
      e7e422cf
    • Braden Shepherdson's avatar
      [metabase-lib] Port date and time parsing and formatting to CLJC (#27551) · 335d161f
      Braden Shepherdson authored
      This adds a cross-platform date/time formatting library in CLJC, with
      (nearly) identical output in both JVM and JS environments.
      
      The only known difference is week numbers.
      
      CLJS (through Moment.js) has ordinal numbers, and renders the week
      number as "34th". Neither the JVM nor Clojure has a handy library for
      this (I'm sure it's out there somewhere, but it seems like a silly
      dep to add) so it renders week numbers as simply "34".
      
      Both platforms have date formatters that use pattern strings (eg.
      `"YYYY-MM-dd"`) to turn date/time objects into strings. There's a strong
      resemblance in how these work and what letters stand for what parts of
      the date and time, but they are far from identical.
      
      Rather than try to hackily convert one set of strings to another with
      regexes or other manipulations, this PR defines a set of names for
      fragments of dates (eg. `:year`, `:day-of-week-full`, `:hour-24-dd`)
      and includes functions to transform a list of these keys into a
      platform-specific format function.
      
      This is portable and transparent, and can be written in Clojure or
      JS code:
      
      ```clj
      [:year "-" :month-dd "-" :day-of-month-dd]   ; 2022-04-08
      [:month-full " " :day-of-month-d ", " :year] ; April 8, 2022
      [:hour-12-dd ":" :minute-dd " " :am-pm]      ; 7:52 AM
      ```
      
      ```js
      [":year", "-", ":month-dd", "-", ":day-of-month-dd"]   ; 2022-04-08
      [":month-full", " ", ":day-of-month-d", ", ", ":year"] ; April 8, 2022
      [":hour-12-dd", ":", ":minute-dd", " ", ":am-pm"]      ; 7:52 AM
      ```
      
      Note that the original code allowed an unrecognized `:date-style` string
      to be used directly as the formatting string. With the move to
      formatting data structures that no longer works. Instead there is a
      fixed map of format strings to the above data structures, that contains
      all the currently used `:date-style` inputs.
      
      If some caller needs a new format someday, we can either: (a) add the
      style to the map; or (b) pass the data structure form directly to the
      `:date-format` option, which if provided is used as the format.
      
      It's tempting to go to all the call sites and replace these `:date-style`
      strings with the new format structures. However, the strings are still
      embedded in the `:visualization_settings` in user appDBs, so we still
      need to recognize them.
      
      Most of the existing functions in the TS library have the same API.
      
      The set of allowed `:date-style` and `:time-style` values is turned into
      a type using `keyof`, so that we get precise type-checking of these
      values rather than simply `string`.
      
      One function has been dropped from the API: `getDateFormatFromStyle`.
      There was no practical way to implement it using the new format data
      structures. The only caller was the date format column settings, and it
      has been rewritten to use the formatted string for its sample date as
      its key instead.
      335d161f
  28. Jan 12, 2023
    • dpsutton's avatar
      restore aliases before annotating (#27637) · 3ddce607
      dpsutton authored
      * restore aliases before annotating
      
      * cleanup
      
      * fix tests
      
      * Don't add escaped->original if aliases have not changed
      
      No need to walk and replace the aliases if they are identical. And in
      that case, no need to keep a mapping of identical to identical. Not
      super important but saves some time and complexity, and keeps other
      tests passing since the presence of [:info :alias/escaped->original] in
      the query caused them to trivially fail.
      
      * oracle has a smaller limit and _expected_ mangled
      
      previous testing behavior was "what happened" and not what should
      happen. we fixed the bug but the "expect garbage" behavior was still
      present
      
      * Relax :alias/escaped->original schema
      
      oracle tests use keywords for the alias
      
      ```clojure
      {:alias/escaped->original
       {:test-data-venues--via-a763718f "test_data_venues__via__venue_id",
        :test-data-users--via--user-id "test_data_users__via__user_id"}}}
      ```
      
      No idea why that is keyworded
      
      * relax `:alias/escaped->original` schema
      
      see previous commit
      3ddce607
  29. Jan 11, 2023
  30. Jan 09, 2023
  31. Dec 29, 2022
  32. Dec 21, 2022
    • Braden Shepherdson's avatar
      [metabase-lib] Port number formatting to CLJC; use it from JS (#27114) · 2537f3d0
      Braden Shepherdson authored
      This adds a cross-platform number formatting library in CLJC, which has
      (nearly) identical output in both JVM and JS environments.
      
      The only known differences are:
      - JVM Clojure has `BigDecimal` support, so isn't limited to a `double`'s
        range.
      - Exact spelling/capitalization of the full names of currencies differs.
          - JVM: "7.34 US Dollar"
          - JS: "7.34 US dollars"
      
      Some future work is required to fully land this. In particular, the
      `currency_in_header` logic should be moved to the table formatters, not
      implemented on the JS side of this change.
      2537f3d0
Loading