Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/cubejs-client-core/src/ResultSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,11 @@ export default class ResultSet<T extends Record<string, any> = 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);
Expand Down Expand Up @@ -779,6 +784,10 @@ export default class ResultSet<T extends Record<string, any> = 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');

Expand Down
Loading