Repository: squashql/squashql (java)

Issue:
Remove minify option from PivotConfig as it is present in Query and QueryMerge
To be done after https://github.com/squashql/squashql/pull/270 is merged.

Pull request:
Remove minify from PivotConfig
Fixes #269 

Patch:
diff --git a/core/src/main/java/io/squashql/query/QueryMergeExecutor.java b/core/src/main/java/io/squashql/query/QueryMergeExecutor.java
index 739f959..b49c9b2 100644
--- a/core/src/main/java/io/squashql/query/QueryMergeExecutor.java
+++ b/core/src/main/java/io/squashql/query/QueryMergeExecutor.java
@@ -34,9 +34,10 @@ public class QueryMergeExecutor {
       Set<Field> columnsFromColumnSets = query.columnSets.values().stream().flatMap(cs -> cs.getNewColumns().stream()).collect(Collectors.toSet());
       List<Field> localRows = getLocalFields(rows, query, columnsFromColumnSets);
       List<Field> localColumns = getLocalFields(columns, query, columnsFromColumnSets);
+      query.minify = false;
 
       return queryExecutor.executePivotQuery(
-              new PivotTableQueryDto(query, localRows, localColumns, false),
+              new PivotTableQueryDto(query, localRows, localColumns),
               CacheStatsDto.builder(),
               user,
               false,
diff --git a/core/src/main/java/io/squashql/query/dto/PivotTableQueryDto.java b/core/src/main/java/io/squashql/query/dto/PivotTableQueryDto.java
index fc60caa..aadb9f9 100644
--- a/core/src/main/java/io/squashql/query/dto/PivotTableQueryDto.java
+++ b/core/src/main/java/io/squashql/query/dto/PivotTableQueryDto.java
@@ -17,5 +17,4 @@ public class PivotTableQueryDto {
   public QueryDto query;
   public List<Field> rows;
   public List<Field> columns;
-  public Boolean minify;
 }
diff --git a/core/src/main/java/io/squashql/query/dto/PivotTableQueryMergeDto.java b/core/src/main/java/io/squashql/query/dto/PivotTableQueryMergeDto.java
index 9596c8c..2e97e61 100644
--- a/core/src/main/java/io/squashql/query/dto/PivotTableQueryMergeDto.java
+++ b/core/src/main/java/io/squashql/query/dto/PivotTableQueryMergeDto.java
@@ -17,5 +17,4 @@ public class PivotTableQueryMergeDto {
   public QueryMergeDto query;
   public List<Field> rows;
   public List<Field> columns;
-  public Boolean minify;
 }
diff --git a/documentation/API.md b/documentation/API.md
index 92d70d0..01b1326 100644
--- a/documentation/API.md
+++ b/documentation/API.md
@@ -58,15 +58,12 @@ To enable the pivot table feature, a `PivotConfig` parameter needs to be pass to
 ```typescript
 const pivotConfig: PivotConfig = {
   rows: [budget.category],
-  columns: [budget.year, budget.month],
-  minify: true
+  columns: [budget.year, budget.month]
 }
 ```
 It is used by SquashQL to know which totals and subtotals needs to be computed. The union of the two lists rows and columns
 must be exactly equal to the list of columns provided in the select.
 
-The parameter `minify` is optional (default is `true`). If `true`, columns full of null values are removed the returned result.
-
 ```typescript
 const income = sumIf("Income", budget.amount, criterion(budget.incomeExpenditure, eq("Income")))
 const expenditure = sumIf("Expenditure", budget.amount, criterion(budget.incomeExpenditure, neq("Income")))
@@ -134,6 +131,25 @@ Note the result of `QueryMerge` can also be displayed as a pivot table by using
 
 Full documentation of [Drilling across in the dedicated page](./documentation/DRILLING-ACROSS.md).
 
+## Minify
+
+Minify is an option to remove columns that contain only null values from the final result. This attribute exists in the 
+following classes:
+
+- Query
+- QueryMerge
+- QueryJoin
+
+If not set, the default value is `true`. You can change it like this:
+
+```typescript
+const q: Query | QueryMerge | QueryJoin = ...
+q.minify = false
+```
+
+It is also useful when using `PivotTableQuery` and `PivotTableQueryMerge`. The attribute needs to be set to the desired value
+on the underlying query object: `PivotTableQuery#query` or `PivotTableQueryMerge#query`.
+
 ## Under the hood
 
 SquashQL helps you to execute multi-dimensional queries compatible with several databases. The syntax is closed to SQL but...
diff --git a/documentation/DRILLING-ACROSS.md b/documentation/DRILLING-ACROSS.md
index f368ed2..55b351c 100644
--- a/documentation/DRILLING-ACROSS.md
+++ b/documentation/DRILLING-ACROSS.md
@@ -278,15 +278,12 @@ querier.executePivotQuery(new QueryMerge(queryShipment, queryReturnWithReason, J
         .then(result => console.log(result))
 ```
 
-Note `PivotConfig` accept another boolean parameter: `minify` set to true by default. It indicates if columns full of null
+Note `QueryMerge#minify` attribute is set to true by default. It indicates if columns full of null
 values should be returned or not in the final result. If set to false:
 
 ```typescript
-const pivotConfig: PivotConfig = {
-  rows: [shipment.product],
-  columns: [returnTable.reason], 
-  minify: false
-}
+const queryMerge = new QueryMerge(queryShipment, queryReturnWithReason, JoinType.FULL)
+queryMerge.minify = false
 ```
 
 <img src="assets/drilling-accross-notminify.png" width="1000">
diff --git a/js/typescript-library/build-from-query-pivot.json b/js/typescript-library/build-from-query-pivot.json
index c6da9bd..57eda13 100644
--- a/js/typescript-library/build-from-query-pivot.json
+++ b/js/typescript-library/build-from-query-pivot.json
@@ -1,1 +1,1 @@
-{"query":{"table":{"name":"myTable","joins":[]},"virtualTableDtos":[],"columns":[{"@class":"io.squashql.query.TableField","fullName":"a","fieldName":"a"},{"@class":"io.squashql.query.TableField","fullName":"b","fieldName":"b"}],"rollupColumns":[],"columnSets":{},"parameters":{},"measures":[{"@class":"io.squashql.query.AggregatedMeasure","field":{"@class":"io.squashql.query.TableField","fullName":"f1","fieldName":"f1"},"aggregationFunction":"avg","alias":"sum"}],"orders":{},"limit":-1},"rows":[{"@class":"io.squashql.query.TableField","fullName":"a","fieldName":"a"}],"columns":[{"@class":"io.squashql.query.TableField","fullName":"b","fieldName":"b"}],"minify":true}
\ No newline at end of file
+{"query":{"table":{"name":"myTable","joins":[]},"virtualTableDtos":[],"columns":[{"@class":"io.squashql.query.TableField","fullName":"a","fieldName":"a"},{"@class":"io.squashql.query.TableField","fullName":"b","fieldName":"b"}],"rollupColumns":[],"columnSets":{},"parameters":{},"measures":[{"@class":"io.squashql.query.AggregatedMeasure","field":{"@class":"io.squashql.query.TableField","fullName":"f1","fieldName":"f1"},"aggregationFunction":"avg","alias":"sum"}],"orders":{},"limit":-1,"minify":true},"rows":[{"@class":"io.squashql.query.TableField","fullName":"a","fieldName":"a"}],"columns":[{"@class":"io.squashql.query.TableField","fullName":"b","fieldName":"b"}]}
\ No newline at end of file
diff --git a/js/typescript-library/src/generate-json-query-merge-pivot.ts b/js/typescript-library/src/generate-json-query-merge-pivot.ts
index 741f0c3..74048b9 100644
--- a/js/typescript-library/src/generate-json-query-merge-pivot.ts
+++ b/js/typescript-library/src/generate-json-query-merge-pivot.ts
@@ -3,7 +3,8 @@ import {TableField, tableField, tableFields} from "./field"
 import {avg, sum} from "./measure"
 import {createPivotTableQueryMerge} from "./querier"
 import {from} from "./queryBuilder"
-import {JoinType, QueryMerge} from "./query"
+import {JoinType} from "./query"
+import {QueryMerge} from "./queryMerge"
 
 export function generateFromQueryMergePivot() {
   const fields = tableFields(["a", "b"])
@@ -16,8 +17,8 @@ export function generateFromQueryMergePivot() {
           .build()
 
   const q = new QueryMerge(query1).join(query2, JoinType.LEFT)
-
-  const pivotQuery = createPivotTableQueryMerge(q, {rows: [tableField("a")], columns: [tableField("b")], minify: false})
+  q.minify = false
+  const pivotQuery = createPivotTableQueryMerge(q, {rows: [tableField("a")], columns: [tableField("b")]})
   const data = JSON.stringify(pivotQuery)
   fs.writeFileSync('build-from-query-merge-pivot.json', data)
 }
diff --git a/js/typescript-library/src/generate-json-query-merge.ts b/js/typescript-library/src/generate-json-query-merge.ts
index 711a537..8ccda0f 100644
--- a/js/typescript-library/src/generate-json-query-merge.ts
+++ b/js/typescript-library/src/generate-json-query-merge.ts
@@ -1,9 +1,10 @@
 import * as fs from "fs"
 import {TableField, tableFields} from "./field"
 import {avg, max, sum} from "./measure"
-import {JoinType, QueryMerge} from "./query"
+import {JoinType} from "./query"
 import {from} from "./queryBuilder"
 import {Action, QueryCacheParameter} from "./parameters"
+import {QueryMerge} from "./queryMerge"
 
 export function generateFromQueryMerge() {
   const fields = tableFields(["a", "b"])
diff --git a/js/typescript-library/src/generate-json-query-pivot.ts b/js/typescript-library/src/generate-json-query-pivot.ts
index 71c5ee8..9e3916d 100644
--- a/js/typescript-library/src/generate-json-query-pivot.ts
+++ b/js/typescript-library/src/generate-json-query-pivot.ts
@@ -12,8 +12,8 @@ export function generateFromQueryPivot() {
                   [],
                   [avg("sum", new TableField("f1"))])
           .build()
-
-  const pivotQuery = createPivotTableQuery(q, {rows: [tableField("a")], columns: [tableField("b")], minify: true})
+  q.minify = true
+  const pivotQuery = createPivotTableQuery(q, {rows: [tableField("a")], columns: [tableField("b")]})
   const data = JSON.stringify(pivotQuery)
   fs.writeFileSync('build-from-query-pivot.json', data)
 }
diff --git a/js/typescript-library/src/index.ts b/js/typescript-library/src/index.ts
index 101ed2d..2fac822 100644
--- a/js/typescript-library/src/index.ts
+++ b/js/typescript-library/src/index.ts
@@ -1,5 +1,5 @@
 export {
-  Query, Table, JoinType, QueryMerge,
+  Query, Table, JoinType,
 } from './query'
 
 export {
@@ -64,3 +64,4 @@ export {
 } from "./virtualtable"
 
 export * from "./dependencies"
+export {QueryMerge} from "./queryMerge"
diff --git a/js/typescript-library/src/pivotTableQuery.ts b/js/typescript-library/src/pivotTableQuery.ts
index 42ea464..e706744 100644
--- a/js/typescript-library/src/pivotTableQuery.ts
+++ b/js/typescript-library/src/pivotTableQuery.ts
@@ -1,22 +1,20 @@
-import {Query, QueryMerge} from "./query"
+import {Query} from "./query"
 import {Field} from "./field"
+import {QueryMerge} from "./queryMerge"
 
 export interface PivotTableQuery {
   query: Query
   rows: Array<Field>
   columns: Array<Field>
-  minify?: boolean
 }
 
 export interface PivotTableQueryMerge {
   query: QueryMerge
   rows: Array<Field>
   columns: Array<Field>
-  minify?: boolean
 }
 
 export interface PivotConfig {
   rows: Array<Field>
   columns: Array<Field>
-  minify?: boolean
 }
diff --git a/js/typescript-library/src/querier.ts b/js/typescript-library/src/querier.ts
index 3784fbb..1dd9293 100644
--- a/js/typescript-library/src/querier.ts
+++ b/js/typescript-library/src/querier.ts
@@ -1,9 +1,10 @@
 import axios, {AxiosInstance} from "axios"
-import {Query, QueryMerge} from "./query"
+import {Query} from "./query"
 import {CreateAxiosDefaults} from "axios/index"
 import {PivotConfig, PivotTableQuery, PivotTableQueryMerge} from "./pivotTableQuery"
 import {Measure} from "./measure"
 import {QueryJoin} from "./queryJoin"
+import {QueryMerge} from "./queryMerge"
 
 export class Querier {
 
@@ -68,11 +69,11 @@ export class Querier {
 }
 
 export function createPivotTableQuery(query: Query, pivotConfig: PivotConfig): PivotTableQuery {
-  return {query, rows: pivotConfig.rows, columns: pivotConfig.columns, minify: pivotConfig.minify}
+  return {query, rows: pivotConfig.rows, columns: pivotConfig.columns}
 }
 
 export function createPivotTableQueryMerge(query: QueryMerge, pivotConfig: PivotConfig): PivotTableQueryMerge {
-  return {query, rows: pivotConfig.rows, columns: pivotConfig.columns, minify: pivotConfig.minify}
+  return {query, rows: pivotConfig.rows, columns: pivotConfig.columns}
 }
 
 export interface QueryResult {
diff --git a/js/typescript-library/src/query.ts b/js/typescript-library/src/query.ts
index 1912884..203cb3f 100644
--- a/js/typescript-library/src/query.ts
+++ b/js/typescript-library/src/query.ts
@@ -1,4 +1,4 @@
-import {GroupColumnSet, ColumnSet, ColumnSetKey} from "./columnsets"
+import {ColumnSet, ColumnSetKey, GroupColumnSet} from "./columnsets"
 import {Field} from "./field"
 import {Measure} from "./measure"
 import {ExplicitOrderDto, Order, OrderKeyword, SimpleOrder} from "./order"
@@ -7,38 +7,6 @@ import {VirtualTable} from "./virtualtable"
 import {serializeMap} from "./util"
 import Criteria from "./criteria"
 
-export class QueryMerge {
-
-  private readonly _queries: Array<Query>
-  private readonly _joins: Array<JoinType>
-  minify?: boolean
-
-  constructor(query: Query) {
-    this._queries = []
-    this._joins = []
-    this._queries.push(query)
-  }
-
-  join(query: Query, joinType: JoinType): QueryMerge {
-    this._queries.push(query)
-    this._joins.push(joinType)
-    return this
-  }
-
-  withParameter(parameter: Parameter): QueryMerge {
-    this._queries.forEach(q => q.withParameter(parameter))
-    return this
-  }
-
-  toJSON() {
-    return {
-      "queries": this._queries,
-      "joinTypes": this._joins,
-      "minify": this.minify,
-    }
-  }
-}
-
 export class Query {
   columns: Array<Field>
   rollupColumns: Array<Field>
diff --git a/js/typescript-library/src/queryMerge.ts b/js/typescript-library/src/queryMerge.ts
new file mode 100644
index 0000000..effb35e
--- /dev/null
+++ b/js/typescript-library/src/queryMerge.ts
@@ -0,0 +1,34 @@
+import {Parameter} from "./parameters"
+import {JoinType, Query} from "./query"
+
+export class QueryMerge {
+
+  private readonly _queries: Array<Query>
+  private readonly _joins: Array<JoinType>
+  minify?: boolean
+
+  constructor(query: Query) {
+    this._queries = []
+    this._joins = []
+    this._queries.push(query)
+  }
+
+  join(query: Query, joinType: JoinType): QueryMerge {
+    this._queries.push(query)
+    this._joins.push(joinType)
+    return this
+  }
+
+  withParameter(parameter: Parameter): QueryMerge {
+    this._queries.forEach(q => q.withParameter(parameter))
+    return this
+  }
+
+  toJSON() {
+    return {
+      "queries": this._queries,
+      "joinTypes": this._joins,
+      "minify": this.minify,
+    }
+  }
+}
diff --git a/server/src/main/java/io/squashql/spring/web/rest/QueryController.java b/server/src/main/java/io/squashql/spring/web/rest/QueryController.java
index 01bbcad..536852b 100644
--- a/server/src/main/java/io/squashql/spring/web/rest/QueryController.java
+++ b/server/src/main/java/io/squashql/spring/web/rest/QueryController.java
@@ -63,7 +63,7 @@ public class QueryController {
             this.squashQLUserSupplier == null ? null : this.squashQLUserSupplier.get(),
             true,
             null);
-    List<Map<String, Object>> cells = PivotTableUtils.generateCells(pt, pivotTableQueryDto.minify);
+    List<Map<String, Object>> cells = PivotTableUtils.generateCells(pt, pivotTableQueryDto.query.minify);
     return ResponseEntity.ok(new PivotTableQueryResultDto(cells, pt.rows, pt.columns, pt.values));
   }
 
@@ -81,7 +81,7 @@ public class QueryController {
             pivotTableQueryMergeDto,
             this.squashQLUserSupplier == null ? null : this.squashQLUserSupplier.get()
     );
-    List<Map<String, Object>> cells = PivotTableUtils.generateCells(pt, pivotTableQueryMergeDto.minify);
+    List<Map<String, Object>> cells = PivotTableUtils.generateCells(pt, pivotTableQueryMergeDto.query.minify);
     return ResponseEntity.ok(new PivotTableQueryResultDto(cells, pt.rows, pt.columns, pt.values));
   }
 


Test patch:
diff --git a/core/src/test/java/io/squashql/jackson/TestQueryS13n.java b/core/src/test/java/io/squashql/jackson/TestQueryS13n.java
index ec91b3e..bf06f84 100644
--- a/core/src/test/java/io/squashql/jackson/TestQueryS13n.java
+++ b/core/src/test/java/io/squashql/jackson/TestQueryS13n.java
@@ -198,7 +198,7 @@ public class TestQueryS13n {
     QueryDto query = Query.from("table")
             .select(List.of(f1, f2), List.of(), List.of())
             .build();
-    PivotTableQueryDto pivotTableQueryDto = new PivotTableQueryDto(query, List.of(f1), List.of(f2), false);
+    PivotTableQueryDto pivotTableQueryDto = new PivotTableQueryDto(query, List.of(f1), List.of(f2));
     String serialize = JacksonUtil.serialize(pivotTableQueryDto);
     PivotTableQueryDto deserialize = JacksonUtil.deserialize(serialize, PivotTableQueryDto.class);
     Assertions.assertThat(deserialize).isEqualTo(pivotTableQueryDto);
diff --git a/core/src/test/java/io/squashql/query/ATestDocDrillacross.java b/core/src/test/java/io/squashql/query/ATestDocDrillacross.java
index 3ac918a..5698f87 100644
--- a/core/src/test/java/io/squashql/query/ATestDocDrillacross.java
+++ b/core/src/test/java/io/squashql/query/ATestDocDrillacross.java
@@ -67,8 +67,7 @@ public abstract class ATestDocDrillacross extends ABaseTestQuery {
     this.executor.executeQueryMerge(queryMerge, null).show();
     PivotTable pt = this.executor.executePivotQueryMerge(new PivotTableQueryMergeDto(QueryMergeDto.from(query1).join(query2, JoinType.FULL),
                     List.of(tableField("product")),
-                    List.of(tableField("reason")),
-                    false),
+                    List.of(tableField("reason"))),
             null);
     pt.show();
     List<Map<String, Object>> cells = PivotTableUtils.generateCells(pt, false);
diff --git a/core/src/test/java/io/squashql/query/ATestPivotTable.java b/core/src/test/java/io/squashql/query/ATestPivotTable.java
index 3847dd2..d018aea 100644
--- a/core/src/test/java/io/squashql/query/ATestPivotTable.java
+++ b/core/src/test/java/io/squashql/query/ATestPivotTable.java
@@ -112,12 +112,12 @@ public abstract class ATestPivotTable extends ABaseTestQuery {
 
     // NO COLUMNS
     {
-      PivotTable result = this.executor.executePivotQuery(new PivotTableQueryDto(queryWithoutRollup, fields, List.of(), false));
+      PivotTable result = this.executor.executePivotQuery(new PivotTableQueryDto(queryWithoutRollup, fields, List.of()));
       Assertions.assertThat(result.table).containsExactlyInAnyOrderElementsOf(resultRollup);
     }
     // NO ROWS
     {
-      PivotTable result = this.executor.executePivotQuery(new PivotTableQueryDto(queryWithoutRollup, List.of(), fields, false));
+      PivotTable result = this.executor.executePivotQuery(new PivotTableQueryDto(queryWithoutRollup, List.of(), fields));
       Assertions.assertThat(result.table).containsExactlyInAnyOrderElementsOf(resultRollup);
     }
   }
@@ -136,7 +136,7 @@ public abstract class ATestPivotTable extends ABaseTestQuery {
             .build();
     List<Field> rows = tableFields(List.of("city"));
     List<Field> columns = tableFields(List.of("spending category"));
-    PivotTable result = this.executor.executePivotQuery(new PivotTableQueryDto(query, rows, columns, false));
+    PivotTable result = this.executor.executePivotQuery(new PivotTableQueryDto(query, rows, columns));
 
     Assertions.assertThat(result.table).containsExactly(
             List.of(GRAND_TOTAL, GRAND_TOTAL, 22d),
@@ -175,7 +175,7 @@ public abstract class ATestPivotTable extends ABaseTestQuery {
             .build();
     List<Field> rows = List.of(this.city);
     List<Field> columns = List.of(this.spendingCategory);
-    PivotTable result = this.executor.executePivotQuery(new PivotTableQueryDto(query, rows, columns, false));
+    PivotTable result = this.executor.executePivotQuery(new PivotTableQueryDto(query, rows, columns));
 
     Assertions.assertThat(result.table).containsExactly(
             List.of(GRAND_TOTAL, GRAND_TOTAL, 22d),
@@ -255,7 +255,7 @@ public abstract class ATestPivotTable extends ABaseTestQuery {
             .select(List.of(), List.of(groupCS), measures)
             .build();
     PivotTable result = this.executor.executePivotQuery(new PivotTableQueryDto(query, Collections.singletonList(country),
-            Collections.singletonList(group), false));
+            Collections.singletonList(group)));
     Assertions.assertThat(result.table).containsExactly(
             List.of("european", "uk", 0d),
             List.of("european", "france", -1d),
@@ -332,7 +332,7 @@ public abstract class ATestPivotTable extends ABaseTestQuery {
             .build();
     List<Field> rows = tableFields(List.of("continent", "country", "city"));
     List<Field> columns = tableFields(List.of("spending category", "spending subcategory"));
-    Assertions.assertThatThrownBy(() -> this.executor.executePivotQuery(new PivotTableQueryDto(query, rows, columns, false)))
+    Assertions.assertThatThrownBy(() -> this.executor.executePivotQuery(new PivotTableQueryDto(query, rows, columns)))
             .hasMessage("Rollup is not supported by this API");
   }
 
@@ -347,13 +347,13 @@ public abstract class ATestPivotTable extends ABaseTestQuery {
     List<Field> rowsWithoutContinent = tableFields(List.of("country", "city"));
     List<Field> columns = tableFields(List.of("spending category", "spending subcategory"));
     // continent is missing despite the fact it is in the select
-    Assertions.assertThatThrownBy(() -> this.executor.executePivotQuery(new PivotTableQueryDto(query, rowsWithoutContinent, columns, false)))
+    Assertions.assertThatThrownBy(() -> this.executor.executePivotQuery(new PivotTableQueryDto(query, rowsWithoutContinent, columns)))
             .hasMessage("[continent] in select but not on rows or columns. Please add those fields on one axis");
 
     List<Field> rows = tableFields(List.of("continent", "country", "city"));
     List<Field> columnsWithoutContinent = tableFields(List.of("spending category"));
     // spending subcategory is missing despite the fact it is in the select
-    Assertions.assertThatThrownBy(() -> this.executor.executePivotQuery(new PivotTableQueryDto(query, rows, columnsWithoutContinent, false)))
+    Assertions.assertThatThrownBy(() -> this.executor.executePivotQuery(new PivotTableQueryDto(query, rows, columnsWithoutContinent)))
             .hasMessage("[spending subcategory] in select but not on rows or columns. Please add those fields on one axis");
   }
 
@@ -368,7 +368,7 @@ public abstract class ATestPivotTable extends ABaseTestQuery {
     List<Field> rows = tableFields(List.of("unknown", "continent", "country", "city"));
     List<Field> columns = tableFields(List.of("spending category", "spending subcategory"));
     // continent is missing despite the fact it is in the select
-    Assertions.assertThatThrownBy(() -> this.executor.executePivotQuery(new PivotTableQueryDto(query, rows, columns, false)))
+    Assertions.assertThatThrownBy(() -> this.executor.executePivotQuery(new PivotTableQueryDto(query, rows, columns)))
             .hasMessage("[unknown] on rows or columns by not in select. Please add those fields in select");
   }
 
@@ -482,8 +482,8 @@ public abstract class ATestPivotTable extends ABaseTestQuery {
    */
   private void verifyResults(TestInfo testInfo, QueryDto query1, QueryDto query2, JoinType joinType, List<Field> rows, List<Field> columns) {
     PivotTable pt = query2 == null
-            ? this.executor.executePivotQuery(new PivotTableQueryDto(query1, rows, columns, false))
-            : this.executor.executePivotQueryMerge(new PivotTableQueryMergeDto(QueryMergeDto.from(query1).join(query2, joinType), rows, columns, false), null);
+            ? this.executor.executePivotQuery(new PivotTableQueryDto(query1, rows, columns))
+            : this.executor.executePivotQueryMerge(new PivotTableQueryMergeDto(QueryMergeDto.from(query1).join(query2, joinType), rows, columns), null);
     Table expectedTabular = tableFromFile(testInfo);
 
     Assertions.assertThat(pt.table).containsExactlyElementsOf(ImmutableList.copyOf(expectedTabular.iterator()));
diff --git a/core/src/test/java/io/squashql/query/ATestQueryCache.java b/core/src/test/java/io/squashql/query/ATestQueryCache.java
index 0b5ca1a..cb8e87e 100644
--- a/core/src/test/java/io/squashql/query/ATestQueryCache.java
+++ b/core/src/test/java/io/squashql/query/ATestQueryCache.java
@@ -506,16 +506,16 @@ public abstract class ATestQueryCache extends ABaseTestQuery {
             .select(List.of(category, ean), List.of(sum("ca", "price")))
             .build();
     int base = 0;
-    this.executor.executePivotQuery(new PivotTableQueryDto(q, List.of(category), List.of(ean), false));
+    this.executor.executePivotQuery(new PivotTableQueryDto(q, List.of(category), List.of(ean)));
     assertCacheStats(0, (base = base + 2));
-    this.executor.executePivotQuery(new PivotTableQueryDto(q, List.of(category, ean), List.of(), false));
+    this.executor.executePivotQuery(new PivotTableQueryDto(q, List.of(category, ean), List.of()));
     assertCacheStats(0, (base = base + 2));
-    this.executor.executePivotQuery(new PivotTableQueryDto(q, List.of(), List.of(category, ean), false));
+    this.executor.executePivotQuery(new PivotTableQueryDto(q, List.of(), List.of(category, ean)));
     assertCacheStats(2, base); // same as the previous
-    this.executor.executePivotQuery(new PivotTableQueryDto(q, List.of(ean), List.of(category), false));
+    this.executor.executePivotQuery(new PivotTableQueryDto(q, List.of(ean), List.of(category)));
     assertCacheStats(2, (base = base + 2));
     // Same as the first query
-    this.executor.executePivotQuery(new PivotTableQueryDto(q, List.of(category), List.of(ean), false));
+    this.executor.executePivotQuery(new PivotTableQueryDto(q, List.of(category), List.of(ean)));
     assertCacheStats(4, base);
   }
 
diff --git a/core/src/test/java/io/squashql/query/ATestVectorAggregation.java b/core/src/test/java/io/squashql/query/ATestVectorAggregation.java
index a76b82e..a94b881 100644
--- a/core/src/test/java/io/squashql/query/ATestVectorAggregation.java
+++ b/core/src/test/java/io/squashql/query/ATestVectorAggregation.java
@@ -386,7 +386,7 @@ public abstract class ATestVectorAggregation extends ABaseTestQuery {
             .select(List.of(ean, competitor), List.of(vector))
             .build();
 
-    PivotTable result = this.executor.executePivotQuery(new PivotTableQueryDto(query, List.of(competitor), List.of(ean), false));
+    PivotTable result = this.executor.executePivotQuery(new PivotTableQueryDto(query, List.of(competitor), List.of(ean)));
     Assertions.assertThat(result.table.headers().stream().map(Header::name))
             .containsExactly(ean.name(), competitor.name(), vector.alias());
     List<List<Object>> points = List.of(
diff --git a/duckdb/src/test/java/io/squashql/TestDuckDBDoc.java b/duckdb/src/test/java/io/squashql/TestDuckDBDoc.java
index a86d38f..6ab980f 100644
--- a/duckdb/src/test/java/io/squashql/TestDuckDBDoc.java
+++ b/duckdb/src/test/java/io/squashql/TestDuckDBDoc.java
@@ -114,8 +114,7 @@ public class TestDuckDBDoc {
       PivotTable pt = this.executor.executePivotQuery(new PivotTableQueryDto(
               query,
               List.of(new TableField("salaryRange.label")),
-              List.of(new TableField("ageRange.label")),
-              false));
+              List.of(new TableField("ageRange.label"))));
       toJson(pt);
     }
   }
@@ -163,8 +162,7 @@ public class TestDuckDBDoc {
     PivotTable pt = this.executor.executePivotQuery(new PivotTableQueryDto(
             query,
             List.of(new TableField("product"), new TableField("region")),
-            List.of(new TableField("month")),
-            false));
+            List.of(new TableField("month"))));
     pt.show();
     toJson(pt);
   }
@@ -253,8 +251,7 @@ public class TestDuckDBDoc {
     PivotTable pt = this.executor.executePivotQuery(new PivotTableQueryDto(
             query,
             fields,
-            List.of(),
-            false));
+            List.of()));
     pt.show();
     toJson(pt);
   }
@@ -300,8 +297,7 @@ public class TestDuckDBDoc {
     PivotTable pt = this.executor.executePivotQuery(new PivotTableQueryDto(
             query,
             fields,
-            List.of(),
-            false));
+            List.of()));
     pt.show();
     toJson(pt);
   }
diff --git a/duckdb/src/test/java/io/squashql/TestDuckDBQuery.java b/duckdb/src/test/java/io/squashql/TestDuckDBQuery.java
index 2ac88ea..197fe02 100644
--- a/duckdb/src/test/java/io/squashql/TestDuckDBQuery.java
+++ b/duckdb/src/test/java/io/squashql/TestDuckDBQuery.java
@@ -92,7 +92,7 @@ public class TestDuckDBQuery {
     TestUtil.assertThatThrownBy(() -> this.executor.executeQueryMerge(queryMergeDto, null))
             .isInstanceOf(LimitExceedException.class)
             .hasMessageContaining("too big");
-    TestUtil.assertThatThrownBy(() -> this.executor.executePivotQueryMerge(new PivotTableQueryMergeDto(queryMergeDto, List.of(tableField("eanId")), List.of(), false), null))
+    TestUtil.assertThatThrownBy(() -> this.executor.executePivotQueryMerge(new PivotTableQueryMergeDto(queryMergeDto, List.of(tableField("eanId")), List.of()), null))
             .isInstanceOf(LimitExceedException.class)
             .hasMessageContaining("too big");
   }
diff --git a/duckdb/src/test/java/io/squashql/TestPivotTable.java b/duckdb/src/test/java/io/squashql/TestPivotTable.java
index c4dc47d..4c49805 100644
--- a/duckdb/src/test/java/io/squashql/TestPivotTable.java
+++ b/duckdb/src/test/java/io/squashql/TestPivotTable.java
@@ -114,10 +114,11 @@ public class TestPivotTable {
             .build();
 
     QueryMergeDto queryMerge = QueryMergeDto.from(query1).join(query2, JoinType.LEFT);
+    queryMerge.minify = true;
     List<Field> rows = List.of(new AliasedField("continent"), new AliasedField("country"));
     List<Field> columns = List.of(this.spendingCategory.as("category"));
 
-    PivotTable pivotTable = this.executor.executePivotQueryMerge(new PivotTableQueryMergeDto(queryMerge, rows, columns, true), null);
+    PivotTable pivotTable = this.executor.executePivotQueryMerge(new PivotTableQueryMergeDto(queryMerge, rows, columns), null);
     {
       List<Map<String, Object>> cells = PivotTableUtils.generateCells(pivotTable, true);
       String expectedCells = """
@@ -354,7 +355,7 @@ public class TestPivotTable {
     // use AliasedField for rows and columns
     List<Field> rows = List.of(new AliasedField("continent"), new AliasedField("country"));
     List<Field> columns = List.of(new AliasedField("category"));
-    PivotTable pivotTable = this.executor.executePivotQuery(new PivotTableQueryDto(query, rows, columns, null));
+    PivotTable pivotTable = this.executor.executePivotQuery(new PivotTableQueryDto(query, rows, columns));
     // We check it does not throw and it returns a result
     Assertions.assertThat(pivotTable.table.count()).isEqualTo(18L);
   }
@@ -386,7 +387,7 @@ public class TestPivotTable {
             .show();
     List<Field> rows = List.of(groupCS.newField, countryAliased);
     List<Field> columns = List.of(this.spendingCategory);
-    PivotTable pivotTable = this.executor.executePivotQuery(new PivotTableQueryDto(query, rows, columns, false));
+    PivotTable pivotTable = this.executor.executePivotQuery(new PivotTableQueryDto(query, rows, columns));
     Assertions.assertThat(pivotTable.table.headers().stream().map(Header::name))
             .containsExactly("group", "countryAliased", this.spendingCategory.fullName, "amountComp", "amount");
     Assertions.assertThat(pivotTable.table).containsExactlyInAnyOrder(
diff --git a/server/src/test/java/io/squashql/client/HttpClientQuerierTest.java b/server/src/test/java/io/squashql/client/HttpClientQuerierTest.java
index 7648e62..5246ca4 100644
--- a/server/src/test/java/io/squashql/client/HttpClientQuerierTest.java
+++ b/server/src/test/java/io/squashql/client/HttpClientQuerierTest.java
@@ -182,7 +182,8 @@ public class HttpClientQuerierTest {
     QueryDto query = Query.from("our_prices")
             .select(tableFields(List.of("ean", "pdv")), List.of(CountMeasure.INSTANCE))
             .build();
-    PivotTableQueryDto pivotTableQuery = new PivotTableQueryDto(query, tableFields(List.of("pdv")), tableFields(List.of("ean")), false);
+    query.minify = false;
+    PivotTableQueryDto pivotTableQuery = new PivotTableQueryDto(query, tableFields(List.of("pdv")), tableFields(List.of("ean")));
     PivotTableQueryResultDto response = this.querier.run(pivotTableQuery);
 
     Assertions.assertThat(response.rows).containsExactlyElementsOf(pivotTableQuery.rows.stream().map(Field::name).toList());
diff --git a/server/src/test/java/io/squashql/js/TestJavascriptLibrary.java b/server/src/test/java/io/squashql/js/TestJavascriptLibrary.java
index a53c1b0..c8e1431 100644
--- a/server/src/test/java/io/squashql/js/TestJavascriptLibrary.java
+++ b/server/src/test/java/io/squashql/js/TestJavascriptLibrary.java
@@ -202,10 +202,11 @@ public class TestJavascriptLibrary {
             .select(tableFields(List.of("a", "b")),
                     List.of(avg("sum", "f1")))
             .build();
+    q.minify = true;
 
     String name = "build-from-query-pivot.json"; // The content of this file is generated by the js code.
     PivotTableQueryDto qjs = JacksonUtil.deserialize(TestUtil.readAllLines(name), PivotTableQueryDto.class);
-    Assertions.assertThat(qjs).isEqualTo(new PivotTableQueryDto(q, tableFields(List.of("a")), tableFields(List.of("b")), true));
+    Assertions.assertThat(qjs).isEqualTo(new PivotTableQueryDto(q, tableFields(List.of("a")), tableFields(List.of("b"))));
   }
 
   @Test
@@ -221,7 +222,8 @@ public class TestJavascriptLibrary {
             .build();
 
     QueryMergeDto query = QueryMergeDto.from(q1).join(q2, JoinType.LEFT);
-    PivotTableQueryMergeDto pivotTableQueryMergeDto = new PivotTableQueryMergeDto(query, tableFields(List.of("a")), tableFields(List.of("b")), false);
+    query.minify = false;
+    PivotTableQueryMergeDto pivotTableQueryMergeDto = new PivotTableQueryMergeDto(query, tableFields(List.of("a")), tableFields(List.of("b")));
 
     String name = "build-from-query-merge-pivot.json"; // The content of this file is generated by the js code.
     PivotTableQueryMergeDto qjs = JacksonUtil.deserialize(TestUtil.readAllLines(name), PivotTableQueryMergeDto.class);
diff --git a/server/src/test/java/io/squashql/spring/dataset/DatasetTestConfig.java b/server/src/test/java/io/squashql/spring/dataset/DatasetTestConfig.java
index cd97a52..6a7cf10 100644
--- a/server/src/test/java/io/squashql/spring/dataset/DatasetTestConfig.java
+++ b/server/src/test/java/io/squashql/spring/dataset/DatasetTestConfig.java
@@ -46,7 +46,7 @@ public class DatasetTestConfig {
     QueryDto query = Query.from("our_prices")
             .select(tableFields(List.of("ean", "pdv", "scenario")), List.of(new AggregatedMeasure("count", "*", "count")))
             .build();
-    PivotTable pt = queryExecutor.executePivotQuery(new PivotTableQueryDto(query, tableFields(List.of("pdv", "ean")), tableFields(List.of("scenario")), false));
+    PivotTable pt = queryExecutor.executePivotQuery(new PivotTableQueryDto(query, tableFields(List.of("pdv", "ean")), tableFields(List.of("scenario"))));
     pt.show();
     toJson(pt);
   }
diff --git a/server/src/test/java/io/squashql/spring/web/rest/QueryControllerTest.java b/server/src/test/java/io/squashql/spring/web/rest/QueryControllerTest.java
index 04c4cd2..5c1e899 100644
--- a/server/src/test/java/io/squashql/spring/web/rest/QueryControllerTest.java
+++ b/server/src/test/java/io/squashql/spring/web/rest/QueryControllerTest.java
@@ -269,7 +269,7 @@ public class QueryControllerTest {
             .build();
 
     this.mvc.perform(MockMvcRequestBuilders.post(QueryController.MAPPING_QUERY_MERGE_PIVOT)
-                    .content(JacksonUtil.serialize(new PivotTableQueryMergeDto(QueryMergeDto.from(query1).join(query2, JoinType.FULL), tableFields(List.of("ean")), List.of(), false)))
+                    .content(JacksonUtil.serialize(new PivotTableQueryMergeDto(QueryMergeDto.from(query1).join(query2, JoinType.FULL), tableFields(List.of("ean")), List.of())))
                     .contentType(MediaType.APPLICATION_JSON))
             .andExpect(result -> {
               String contentAsString = result.getResponse().getContentAsString();
diff --git a/server/src/test/resources/build-from-query-pivot.json b/server/src/test/resources/build-from-query-pivot.json
index c6da9bd..57eda13 100644
--- a/server/src/test/resources/build-from-query-pivot.json
+++ b/server/src/test/resources/build-from-query-pivot.json
@@ -1,1 +1,1 @@
-{"query":{"table":{"name":"myTable","joins":[]},"virtualTableDtos":[],"columns":[{"@class":"io.squashql.query.TableField","fullName":"a","fieldName":"a"},{"@class":"io.squashql.query.TableField","fullName":"b","fieldName":"b"}],"rollupColumns":[],"columnSets":{},"parameters":{},"measures":[{"@class":"io.squashql.query.AggregatedMeasure","field":{"@class":"io.squashql.query.TableField","fullName":"f1","fieldName":"f1"},"aggregationFunction":"avg","alias":"sum"}],"orders":{},"limit":-1},"rows":[{"@class":"io.squashql.query.TableField","fullName":"a","fieldName":"a"}],"columns":[{"@class":"io.squashql.query.TableField","fullName":"b","fieldName":"b"}],"minify":true}
\ No newline at end of file
+{"query":{"table":{"name":"myTable","joins":[]},"virtualTableDtos":[],"columns":[{"@class":"io.squashql.query.TableField","fullName":"a","fieldName":"a"},{"@class":"io.squashql.query.TableField","fullName":"b","fieldName":"b"}],"rollupColumns":[],"columnSets":{},"parameters":{},"measures":[{"@class":"io.squashql.query.AggregatedMeasure","field":{"@class":"io.squashql.query.TableField","fullName":"f1","fieldName":"f1"},"aggregationFunction":"avg","alias":"sum"}],"orders":{},"limit":-1,"minify":true},"rows":[{"@class":"io.squashql.query.TableField","fullName":"a","fieldName":"a"}],"columns":[{"@class":"io.squashql.query.TableField","fullName":"b","fieldName":"b"}]}
\ No newline at end of file