Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use validPercentOfTotal as source of truth #5636

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

djbarnwal
Copy link
Member

@djbarnwal djbarnwal commented Sep 7, 2024

Closes https://github.com/rilldata/rill-private-issues/issues/608
Use validPercentOfTotal as source of truth to validate if measure is summable. Also maintain support for sum and count for legacy dashboards not having the key in their spec.

import { SortType } from "./proto-state/derived-types";
import type { TimeControlState } from "./time-controls/time-control-store";

const countRegex = /count(?=[^(]*\()/i;
const sumRegex = /sum(?=[^(]*\()/i;

export function isSummableMeasure(measure: MetricsViewSpecMeasureV2): boolean {
Copy link
Contributor

@ericpgreen2 ericpgreen2 Sep 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point, we should change this function name to isMeasureValidPercentOfTotal

@ericpgreen2
Copy link
Contributor

Can you change the PR description & title to match the new code before merging?

@djbarnwal djbarnwal changed the title Add clickhouse functions which are summable Use validPercentOfTotal as source of truth Sep 13, 2024
@djbarnwal djbarnwal merged commit a4fc031 into main Sep 13, 2024
7 checks passed
@djbarnwal djbarnwal deleted the fix/clickhouse-summable-measure branch September 13, 2024 17:04
ericpgreen2 pushed a commit that referenced this pull request Sep 13, 2024
* Add clickhouse functions which are summable

* Rely on metrics spec for valid percent of total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants