XLSX Pivot Table Downloads have 'Native' Pivot Table (#43791)
* XLSX Pivot Table Downloads have 'Native' Pivot Table Addresses: #2473 The xlsx downloads work fine for regular tables. However, on Pivot Table downloads, the resulting file isn't pivoted and is formatted somewhat strangely (it contains additional rows related to totals, has an extra 'pivot-grouping' column). Now, the downloaded xlsx file contains 2 sheets: - the data sheet containing the question's rows unpivoted. If you were constructing a pivot table yourself, you would probably start with this shape of data. - the pivot sheet containing a 'native' Pivot table whose reference points to the data on the data sheet, and whose columns, rows, and values align with the cols, rows, and measures set up in Metabase * Silly typo! * Exported Pivot uses correct aggregation (sum, count, stddev, avg, min, max) * data for pivot exports now also uses the formatting * Add a test asserting that a pivot table exists in the xlsx file * add-row! is a method dispatching on sheet class * remove unnecessary hint * address review feedback: - consolidate the aggregation function key fns into one function in the .xlsx namespace this was moved out of postprocessing so that the xlsx specific fns don't litter the post processing namespace at this time - clean up an unnecessary destructiring inside the native-pivot function - don't shadow 'name' inside the body of a fn * Add tests that confirm zero-col and zero-row situations work * Consolidate the atoms used to store pivot rows/options
Showing
- src/metabase/query_processor/pivot/postprocess.clj 6 additions, 3 deletionssrc/metabase/query_processor/pivot/postprocess.clj
- src/metabase/query_processor/streaming/xlsx.clj 182 additions, 32 deletionssrc/metabase/query_processor/streaming/xlsx.clj
- test/metabase/api/downloads_exports_test.clj 101 additions, 2 deletionstest/metabase/api/downloads_exports_test.clj
Please register or sign in to comment