Skip to content
Snippets Groups Projects
Unverified Commit 7f8b20b6 authored by Tom Robinson's avatar Tom Robinson Committed by GitHub
Browse files

Add Share/CountIf/SumIf to suggestions (#12136)

parent 37dfebf0
No related branches found
No related tags found
No related merge requests found
......@@ -251,6 +251,11 @@ export function suggest({
),
),
);
finalSuggestions.push(
...["sum-where", "count-where", "share"].map(short =>
functionSuggestion("aggregations", short, true),
),
);
functions = FUNCTIONS_BY_TYPE["number"];
} else {
functions = FUNCTIONS_BY_TYPE[expectedType];
......
......@@ -15,13 +15,16 @@ import { ORDERS, REVIEWS } from "__support__/sample_dataset_fixture";
const AGGREGATION_FUNCTIONS = [
{ type: "aggregations", text: "Average(" },
{ type: "aggregations", text: "Count " },
{ type: "aggregations", text: "CountIf(" },
{ type: "aggregations", text: "CumulativeCount " },
{ type: "aggregations", text: "CumulativeSum(" },
{ type: "aggregations", text: "Distinct(" },
{ type: "aggregations", text: "Max(" },
{ type: "aggregations", text: "Min(" },
{ type: "aggregations", text: "Share(" },
{ type: "aggregations", text: "StandardDeviation(" },
{ type: "aggregations", text: "Sum(" },
{ type: "aggregations", text: "SumIf(" },
];
const STRING_FUNCTIONS = [
{ text: "concat(", type: "functions" },
......@@ -305,6 +308,7 @@ describe("metabase/lib/expression/suggest", () => {
it("should suggest partial matches in aggregation", () => {
expect(suggest({ source: "1 + C", ...aggregationOpts })).toEqual([
{ type: "aggregations", text: "Count " },
{ type: "aggregations", text: "CountIf(" },
{ type: "aggregations", text: "CumulativeCount " },
{ type: "aggregations", text: "CumulativeSum(" },
]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment