From 901d64ec3cd5868c67236879c26818d666b587b9 Mon Sep 17 00:00:00 2001 From: Aviral Utkarsh Date: Sat, 28 Mar 2026 20:32:56 +0530 Subject: [PATCH] fixed chartPivot and tablePivot issue #8050 --- packages/cubejs-client-core/src/ResultSet.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/cubejs-client-core/src/ResultSet.ts b/packages/cubejs-client-core/src/ResultSet.ts index 5f3ff540d9976..4f1d680c04929 100644 --- a/packages/cubejs-client-core/src/ResultSet.ts +++ b/packages/cubejs-client-core/src/ResultSet.ts @@ -719,6 +719,11 @@ export default class ResultSet = any> { * ``` */ public chartPivot(pivotConfig?: PivotConfig): ChartPivotRow[] { + + if (this.queryType !== QUERY_TYPE.REGULAR_QUERY) { + throw new Error(`Method is not supported for a '${this.queryType}' query type. Please use decompose`); + } + const validate = (value: string) => { if (this.parseDateMeasures && LocalDateRegex.test(value)) { return new Date(value); @@ -779,6 +784,10 @@ export default class ResultSet = any> { * @returns An array of pivoted rows */ public tablePivot(pivotConfig?: PivotConfig): Array<{ [key: string]: string | number | boolean }> { + if (this.queryType !== QUERY_TYPE.REGULAR_QUERY) { + throw new Error(`Method is not supported for a '${this.queryType}' query type. Please use decompose`); + } + const normalizedPivotConfig = this.normalizePivotConfig(pivotConfig || {}); const isMeasuresPresent = normalizedPivotConfig.x.concat(normalizedPivotConfig.y).includes('measures');