Skip to content
Snippets Groups Projects
Commit 91c4eea0 authored by Cam Saul's avatar Cam Saul
Browse files

QB should use normalized cumulative count/sum MBQL names :abcd:

parent e8f9a092
Branches
Tags
No related merge requests found
......@@ -5,9 +5,9 @@ export const VALID_OPERATORS = new Set(["+", "-", "*", "/"]);
export const VALID_AGGREGATIONS = new Map(
Object.entries({
count: t`Count`,
cum_count: t`CumulativeCount`,
"cum-count": t`CumulativeCount`,
sum: t`Sum`,
cum_sum: t`CumulativeSum`,
"cum-sum": t`CumulativeSum`,
distinct: t`Distinct`,
stddev: t`StandardDeviation`,
avg: t`Average`,
......@@ -16,10 +16,10 @@ export const VALID_AGGREGATIONS = new Map(
}),
);
export const NULLARY_AGGREGATIONS = ["count", "cum_count"];
export const NULLARY_AGGREGATIONS = ["count", "cum-count"];
export const UNARY_AGGREGATIONS = [
"sum",
"cum_sum",
"cum-sum",
"distinct",
"stddev",
"avg",
......
......@@ -48,9 +48,9 @@ export function createQuery(type = "query", databaseId, tableId) {
const METRIC_NAME_BY_AGGREGATION = {
count: "count",
cum_count: "count",
"cum-count": "count",
sum: "sum",
cum_sum: "sum",
"cum-sum": "sum",
distinct: "count",
avg: "avg",
min: "min",
......@@ -59,9 +59,9 @@ const METRIC_NAME_BY_AGGREGATION = {
const METRIC_TYPE_BY_AGGREGATION = {
count: TYPE.Integer,
cum_count: TYPE.Integer,
"cum-count": TYPE.Integer,
sum: TYPE.Float,
cum_sum: TYPE.Float,
"cum-sum": TYPE.Float,
distinct: TYPE.Integer,
avg: TYPE.Float,
min: TYPE.Float,
......@@ -612,7 +612,7 @@ const Query = {
return [t`Raw data`];
case "count":
return [t`Count`];
case "cum_count":
case "cum-count":
return [t`Cumulative count`];
case "avg":
return [
......@@ -634,7 +634,7 @@ const Query = {
t`Sum of `,
Query.getFieldName(tableMetadata, aggregation[1], options),
];
case "cum_sum":
case "cum-sum":
return [
t`Cumulative sum of `,
Query.getFieldName(tableMetadata, aggregation[1], options),
......
......@@ -489,7 +489,7 @@ let Aggregators = [
},
{
name: t`Cumulative sum of ...`,
short: "cum_sum",
short: "cum-sum",
description: t`Additive sum of all the values of a column.\ne.x. total revenue over time.`,
validFieldsFilters: [summableFields],
requiresField: true,
......@@ -497,7 +497,7 @@ let Aggregators = [
},
{
name: t`Cumulative count of rows`,
short: "cum_count",
short: "cum-count",
description: t`Additive count of the number of rows.\ne.x. total number of sales over time.`,
validFieldsFilters: [],
requiresField: false,
......
......@@ -109,7 +109,7 @@ type CountAgg = ["count"];
type CountFieldAgg = ["count", ConcreteField];
type AvgAgg = ["avg", ConcreteField];
type CumSumAgg = ["cum_sum", ConcreteField];
type CumSumAgg = ["cum-sum", ConcreteField];
type DistinctAgg = ["distinct", ConcreteField];
type StdDevAgg = ["stddev", ConcreteField];
type SumAgg = ["sum", ConcreteField];
......
......@@ -12,7 +12,7 @@ import type {
} from "metabase/meta/types/Visualization";
import type { TableMetadata } from "metabase/meta/types/Metadata";
const omittedAggregations = ["rows", "cum_sum", "cum_count", "stddev"];
const omittedAggregations = ["rows", "cum-sum", "cum-count", "stddev"];
const getAggregationOptionsForSummarize = query => {
return query
.table()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment