Repository: squashql/squashql
Pull request #326 (2024-05-01 10:26:32)

Code refactoring


Patch:
diff --git a/bigquery/src/main/java/io/squashql/query/database/BigQueryQueryRewriter.java b/bigquery/src/main/java/io/squashql/query/database/BigQueryQueryRewriter.java
index f72078b..685ad48 100644
--- a/bigquery/src/main/java/io/squashql/query/database/BigQueryQueryRewriter.java
+++ b/bigquery/src/main/java/io/squashql/query/database/BigQueryQueryRewriter.java
@@ -13,7 +13,7 @@ public class BigQueryQueryRewriter implements QueryRewriter {
 
   @Override
   public String functionExpression(FunctionTypedField ftf) {
-    if (SQLFunctions.SUPPORTED_DATE_FUNCTIONS.contains(ftf.function())) {
+    if (SqlFunctions.SUPPORTED_DATE_FUNCTIONS.contains(ftf.function())) {
       // https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#extract
       return String.format("EXTRACT(%s FROM %s)", ftf.function(), ftf.field().sqlExpression(this));
     } else {
diff --git a/core/src/main/java/io/squashql/jackson/JacksonUtil.java b/core/src/main/java/io/squashql/jackson/JacksonUtil.java
index 52d9747..67c3151 100644
--- a/core/src/main/java/io/squashql/jackson/JacksonUtil.java
+++ b/core/src/main/java/io/squashql/jackson/JacksonUtil.java
@@ -1,13 +1,16 @@
 package io.squashql.jackson;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JavaType;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.fasterxml.jackson.databind.type.TypeFactory;
 import com.fasterxml.jackson.datatype.jsr310.JSR310Module;
 import io.squashql.query.Field;
 import io.squashql.query.dto.QueryDto;
 
 import java.util.LinkedHashMap;
+import java.util.List;
 import java.util.Map;
 
 public class JacksonUtil {
@@ -40,4 +43,12 @@ public class JacksonUtil {
       throw new RuntimeException(e);
     }
   }
+
+  public static JavaType getListJavaType(Class<?> clazz) {
+    return TypeFactory.defaultInstance().constructCollectionType(List.class, clazz);
+  }
+
+  public static JavaType getJavaType(Class<?> clazz) {
+    return TypeFactory.defaultInstance().constructType(clazz);
+  }
 }
diff --git a/core/src/main/java/io/squashql/jackson/SquashQLTypeFactory.java b/core/src/main/java/io/squashql/jackson/SquashQLTypeFactory.java
deleted file mode 100644
index 05b2ac3..0000000
--- a/core/src/main/java/io/squashql/jackson/SquashQLTypeFactory.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package io.squashql.jackson;
-
-import com.fasterxml.jackson.databind.JavaType;
-import com.fasterxml.jackson.databind.type.TypeFactory;
-
-import java.util.List;
-
-public class SquashQLTypeFactory {
-
-  public static JavaType listOf(Class<?> clazz) {
-    return TypeFactory.defaultInstance().constructCollectionType(List.class, clazz);
-  }
-
-  public static JavaType of(Class<?> clazz) {
-    return TypeFactory.defaultInstance().constructType(clazz);
-  }
-}
diff --git a/core/src/main/java/io/squashql/query/AComparisonExecutor.java b/core/src/main/java/io/squashql/query/AComparisonExecutor.java
index 101e508..759ecb7 100644
--- a/core/src/main/java/io/squashql/query/AComparisonExecutor.java
+++ b/core/src/main/java/io/squashql/query/AComparisonExecutor.java
@@ -1,7 +1,7 @@
 package io.squashql.query;
 
-import io.squashql.query.comp.BinaryOperations;
 import io.squashql.query.compiled.CompiledComparisonMeasure;
+import io.squashql.query.util.BinaryOperations;
 import io.squashql.table.Table;
 import org.eclipse.collections.api.map.primitive.IntIntMap;
 import org.eclipse.collections.api.map.primitive.MutableIntIntMap;
diff --git a/core/src/main/java/io/squashql/query/GrandTotalComparisonExecutor.java b/core/src/main/java/io/squashql/query/GrandTotalComparisonExecutor.java
index fbb4a79..14bd4b5 100644
--- a/core/src/main/java/io/squashql/query/GrandTotalComparisonExecutor.java
+++ b/core/src/main/java/io/squashql/query/GrandTotalComparisonExecutor.java
@@ -1,7 +1,7 @@
 package io.squashql.query;
 
 import io.squashql.query.compiled.CompiledGrandTotalComparisonMeasure;
-import io.squashql.query.database.SQLTranslator;
+import io.squashql.query.database.SqlTranslator;
 import io.squashql.table.Table;
 import org.eclipse.collections.api.map.primitive.ObjectIntMap;
 
@@ -14,7 +14,7 @@ public class GrandTotalComparisonExecutor extends AComparisonExecutor<CompiledGr
                                                                  ObjectIntMap<String> indexByColumn,
                                                                  Table readFromTable) {
     return (row, __) -> {
-      indexByColumn.forEachKeyValue((value, index) -> row[index] = SQLTranslator.TOTAL_CELL);
+      indexByColumn.forEachKeyValue((value, index) -> row[index] = SqlTranslator.TOTAL_CELL);
       return true;
     };
   }
diff --git a/core/src/main/java/io/squashql/query/ParentComparisonExecutor.java b/core/src/main/java/io/squashql/query/ParentComparisonExecutor.java
index ca21ab1..86b6ed8 100644
--- a/core/src/main/java/io/squashql/query/ParentComparisonExecutor.java
+++ b/core/src/main/java/io/squashql/query/ParentComparisonExecutor.java
@@ -1,7 +1,7 @@
 package io.squashql.query;
 
 import io.squashql.query.compiled.CompiledComparisonMeasureReferencePosition;
-import io.squashql.query.database.SQLTranslator;
+import io.squashql.query.database.SqlTranslator;
 import io.squashql.query.database.SqlUtils;
 import io.squashql.table.Table;
 import io.squashql.type.TypedField;
@@ -40,8 +40,8 @@ public class ParentComparisonExecutor extends AComparisonExecutor<CompiledCompar
         String name = SqlUtils.squashqlExpression(ancestor);
         if (this.indexByColumn.containsKey(name)) {
           int index = this.indexByColumn.get(name);
-          if (!SQLTranslator.TOTAL_CELL.equals(row[index])) {
-            row[index] = SQLTranslator.TOTAL_CELL;
+          if (!SqlTranslator.TOTAL_CELL.equals(row[index])) {
+            row[index] = SqlTranslator.TOTAL_CELL;
             if (!this.grandTotalAlongAncestors) {
               break;
             }
diff --git a/core/src/main/java/io/squashql/query/PeriodComparisonExecutor.java b/core/src/main/java/io/squashql/query/PeriodComparisonExecutor.java
index 6779141..b5f39e2 100644
--- a/core/src/main/java/io/squashql/query/PeriodComparisonExecutor.java
+++ b/core/src/main/java/io/squashql/query/PeriodComparisonExecutor.java
@@ -2,7 +2,7 @@ package io.squashql.query;
 
 import io.squashql.query.compiled.CompiledComparisonMeasureReferencePosition;
 import io.squashql.query.compiled.CompiledPeriod;
-import io.squashql.query.database.SQLTranslator;
+import io.squashql.query.database.SqlTranslator;
 import io.squashql.query.database.SqlUtils;
 import io.squashql.table.Table;
 import io.squashql.type.TypedField;
@@ -170,7 +170,7 @@ public class PeriodComparisonExecutor extends AComparisonExecutor<CompiledCompar
     }
 
     private static int readAsLong(Object o) {
-      if (SQLTranslator.TOTAL_CELL.equals(o)) {
+      if (SqlTranslator.TOTAL_CELL.equals(o)) {
         return -1;
       }
       return (int) ((Number) o).longValue(); // with some database, year could be Long object.
diff --git a/core/src/main/java/io/squashql/query/QueryExecutor.java b/core/src/main/java/io/squashql/query/QueryExecutor.java
index 0590bcc..c19742f 100644
--- a/core/src/main/java/io/squashql/query/QueryExecutor.java
+++ b/core/src/main/java/io/squashql/query/QueryExecutor.java
@@ -1,5 +1,9 @@
 package io.squashql.query;
 
+import io.squashql.query.cache.CaffeineQueryCache;
+import io.squashql.query.cache.EmptyQueryCache;
+import io.squashql.query.cache.GlobalCache;
+import io.squashql.query.cache.QueryCache;
 import io.squashql.query.compiled.*;
 import io.squashql.query.database.DatabaseQuery;
 import io.squashql.query.database.QueryEngine;
@@ -7,11 +11,10 @@ import io.squashql.query.database.QueryScope;
 import io.squashql.query.database.SqlUtils;
 import io.squashql.query.dto.*;
 import io.squashql.query.join.ExperimentalQueryJoinExecutor;
+import io.squashql.query.measure.visitor.PartialMeasureVisitor;
 import io.squashql.query.parameter.QueryCacheParameter;
 import io.squashql.table.*;
-import io.squashql.table.PivotTableContext;
 import io.squashql.type.TypedField;
-import io.squashql.query.measure.visitor.PartialMeasureVisitor;
 import io.squashql.util.Queries;
 import lombok.extern.slf4j.Slf4j;
 
diff --git a/core/src/main/java/io/squashql/query/CaffeineQueryCache.java b/core/src/main/java/io/squashql/query/cache/CaffeineQueryCache.java
similarity index 97%
rename from core/src/main/java/io/squashql/query/CaffeineQueryCache.java
rename to core/src/main/java/io/squashql/query/cache/CaffeineQueryCache.java
index 8b462f6..5684a20 100644
--- a/core/src/main/java/io/squashql/query/CaffeineQueryCache.java
+++ b/core/src/main/java/io/squashql/query/cache/CaffeineQueryCache.java
@@ -1,4 +1,4 @@
-package io.squashql.query;
+package io.squashql.query.cache;
 
 import com.github.benmanes.caffeine.cache.Cache;
 import com.github.benmanes.caffeine.cache.Caffeine;
@@ -7,6 +7,9 @@ import com.github.benmanes.caffeine.cache.stats.CacheStats;
 import com.github.benmanes.caffeine.cache.stats.ConcurrentStatsCounter;
 import com.github.benmanes.caffeine.cache.stats.StatsCounter;
 import com.google.common.util.concurrent.Striped;
+import io.squashql.query.CountMeasure;
+import io.squashql.query.Header;
+import io.squashql.query.SquashQLUser;
 import io.squashql.query.compiled.CompiledMeasure;
 import io.squashql.query.database.SqlUtils;
 import io.squashql.query.dictionary.ObjectArrayDictionary;
diff --git a/core/src/main/java/io/squashql/query/EmptyQueryCache.java b/core/src/main/java/io/squashql/query/cache/EmptyQueryCache.java
similarity index 93%
rename from core/src/main/java/io/squashql/query/EmptyQueryCache.java
rename to core/src/main/java/io/squashql/query/cache/EmptyQueryCache.java
index 04fe1df..85bcf05 100644
--- a/core/src/main/java/io/squashql/query/EmptyQueryCache.java
+++ b/core/src/main/java/io/squashql/query/cache/EmptyQueryCache.java
@@ -1,5 +1,6 @@
-package io.squashql.query;
+package io.squashql.query.cache;
 
+import io.squashql.query.SquashQLUser;
 import io.squashql.query.compiled.CompiledMeasure;
 import io.squashql.query.dto.CacheStatsDto;
 import io.squashql.table.ColumnarTable;
diff --git a/core/src/main/java/io/squashql/query/GlobalCache.java b/core/src/main/java/io/squashql/query/cache/GlobalCache.java
similarity index 96%
rename from core/src/main/java/io/squashql/query/GlobalCache.java
rename to core/src/main/java/io/squashql/query/cache/GlobalCache.java
index 5b0b3cc..bd6a2b1 100644
--- a/core/src/main/java/io/squashql/query/GlobalCache.java
+++ b/core/src/main/java/io/squashql/query/cache/GlobalCache.java
@@ -1,5 +1,6 @@
-package io.squashql.query;
+package io.squashql.query.cache;
 
+import io.squashql.query.SquashQLUser;
 import io.squashql.query.compiled.CompiledMeasure;
 import io.squashql.query.dto.CacheStatsDto;
 import io.squashql.table.ColumnarTable;
diff --git a/core/src/main/java/io/squashql/query/QueryCache.java b/core/src/main/java/io/squashql/query/cache/QueryCache.java
similarity index 92%
rename from core/src/main/java/io/squashql/query/QueryCache.java
rename to core/src/main/java/io/squashql/query/cache/QueryCache.java
index 39135d7..cd5cf92 100644
--- a/core/src/main/java/io/squashql/query/QueryCache.java
+++ b/core/src/main/java/io/squashql/query/cache/QueryCache.java
@@ -1,5 +1,6 @@
-package io.squashql.query;
+package io.squashql.query.cache;
 
+import io.squashql.query.SquashQLUser;
 import io.squashql.query.compiled.CompiledMeasure;
 import io.squashql.query.database.QueryScope;
 import io.squashql.query.dto.CacheStatsDto;
diff --git a/core/src/main/java/io/squashql/query/compiled/CompiledCriteria.java b/core/src/main/java/io/squashql/query/compiled/CompiledCriteria.java
index ab7a706..b7122d8 100644
--- a/core/src/main/java/io/squashql/query/compiled/CompiledCriteria.java
+++ b/core/src/main/java/io/squashql/query/compiled/CompiledCriteria.java
@@ -1,7 +1,7 @@
 package io.squashql.query.compiled;
 
 import io.squashql.query.database.QueryRewriter;
-import io.squashql.query.database.SQLTranslator;
+import io.squashql.query.database.SqlTranslator;
 import io.squashql.query.dto.*;
 import io.squashql.type.TableTypedField;
 import io.squashql.type.TypedField;
@@ -57,14 +57,14 @@ public record CompiledCriteria(ConditionDto condition, ConditionType conditionTy
 
     if (dto instanceof SingleValueConditionDto svc) {
       Object value = svc.value;
-      Function<Object, String> sqlMapper = SQLTranslator.getQuoteFn(field.type(), value.getClass(), queryRewriter);
+      Function<Object, String> sqlMapper = SqlTranslator.getQuoteFn(field.type(), value.getClass(), queryRewriter);
       return switch (dto.type()) {
         case EQ, NEQ, LT, LE, GT, GE, LIKE -> expression + " " + dto.type().sqlInfix + " " + sqlMapper.apply(value);
         case ARRAY_CONTAINS -> queryRewriter.arrayContains(field, sqlMapper.apply(value));
         default -> throw new IllegalStateException("Unexpected value: " + dto.type());
       };
     } else if (dto instanceof InConditionDto ic) {
-      Function<Object, String> sqlMapper = SQLTranslator.getQuoteFn(field.type(), ic.values.iterator().next().getClass(), queryRewriter);
+      Function<Object, String> sqlMapper = SqlTranslator.getQuoteFn(field.type(), ic.values.iterator().next().getClass(), queryRewriter);
       return expression + " " + dto.type().sqlInfix + " (" +
               ic.values
                       .stream()
diff --git a/core/src/main/java/io/squashql/query/compiled/Evaluator.java b/core/src/main/java/io/squashql/query/compiled/Evaluator.java
index 8f00c14..f314032 100644
--- a/core/src/main/java/io/squashql/query/compiled/Evaluator.java
+++ b/core/src/main/java/io/squashql/query/compiled/Evaluator.java
@@ -3,8 +3,8 @@ package io.squashql.query.compiled;
 import io.squashql.query.*;
 import io.squashql.query.QueryExecutor.ExecutionContext;
 import io.squashql.query.QueryExecutor.QueryPlanNodeKey;
-import io.squashql.query.comp.BinaryOperations;
 import io.squashql.query.database.QueryScope;
+import io.squashql.query.util.BinaryOperations;
 import io.squashql.store.UnknownType;
 import io.squashql.table.Table;
 import io.squashql.type.TypedField;
diff --git a/core/src/main/java/io/squashql/query/compiled/NestedQueryTable.java b/core/src/main/java/io/squashql/query/compiled/NestedQueryTable.java
index 8a69aba..da5fa43 100644
--- a/core/src/main/java/io/squashql/query/compiled/NestedQueryTable.java
+++ b/core/src/main/java/io/squashql/query/compiled/NestedQueryTable.java
@@ -2,7 +2,7 @@ package io.squashql.query.compiled;
 
 import io.squashql.query.database.DatabaseQuery;
 import io.squashql.query.database.QueryRewriter;
-import io.squashql.query.database.SQLTranslator;
+import io.squashql.query.database.SqlTranslator;
 
 import java.util.List;
 
@@ -11,7 +11,7 @@ public record NestedQueryTable(DatabaseQuery query, List<CompiledJoin> joins) im
   @Override
   public String sqlExpression(QueryRewriter queryRewriter) {
     StringBuilder statement = new StringBuilder();
-    statement.append("(").append(SQLTranslator.translate(this.query, queryRewriter)).append(")");
+    statement.append("(").append(SqlTranslator.translate(this.query, queryRewriter)).append(")");
     if (this.joins != null) {
       this.joins.forEach(j -> statement.append(j.sqlExpression(queryRewriter)));
     }
diff --git a/core/src/main/java/io/squashql/query/database/AQueryEngine.java b/core/src/main/java/io/squashql/query/database/AQueryEngine.java
index 8f8f223..c0073dc 100644
--- a/core/src/main/java/io/squashql/query/database/AQueryEngine.java
+++ b/core/src/main/java/io/squashql/query/database/AQueryEngine.java
@@ -39,7 +39,7 @@ public abstract class AQueryEngine<T extends Datastore> implements QueryEngine<T
   }
 
   protected String createSqlStatement(DatabaseQuery query) {
-    return SQLTranslator.translate(query, queryRewriter());
+    return SqlTranslator.translate(query, queryRewriter());
   }
 
   protected abstract Table retrieveAggregates(DatabaseQuery query, String sql);
diff --git a/core/src/main/java/io/squashql/query/database/QueryRewriter.java b/core/src/main/java/io/squashql/query/database/QueryRewriter.java
index c6a4d6e..7bf5a20 100644
--- a/core/src/main/java/io/squashql/query/database/QueryRewriter.java
+++ b/core/src/main/java/io/squashql/query/database/QueryRewriter.java
@@ -39,7 +39,7 @@ public interface QueryRewriter {
 
   /**
    * Customizes what's written in the SELECT statement AND GROUP BY for the given selected column.
-   * See {@link SQLTranslator}.
+   * See {@link SqlTranslator}.
    *
    * @param f field to use in select
    * @return the customized argument
@@ -50,7 +50,7 @@ public interface QueryRewriter {
 
   /**
    * Customizes what's written in the SELECT statement AND GROUP BY for the given selected column.
-   * See {@link SQLTranslator}.
+   * See {@link SqlTranslator}.
    *
    * @param f field to use in select
    * @return the customized argument
@@ -60,7 +60,7 @@ public interface QueryRewriter {
   }
 
   /**
-   * Customizes what's written in the grouping function. See {@link SQLTranslator}.
+   * Customizes what's written in the grouping function. See {@link SqlTranslator}.
    *
    * @param f field to use in select
    * @return the customized argument
@@ -88,7 +88,7 @@ public interface QueryRewriter {
   }
 
   /**
-   * Customizes what's written within the ROLLUP function as argument for the given column. See {@link SQLTranslator}.
+   * Customizes what's written within the ROLLUP function as argument for the given column. See {@link SqlTranslator}.
    *
    * @param f field to use in rollup
    * @return the customized argument
diff --git a/core/src/main/java/io/squashql/query/database/SQLFunctions.java b/core/src/main/java/io/squashql/query/database/SqlFunctions.java
similarity index 80%
rename from core/src/main/java/io/squashql/query/database/SQLFunctions.java
rename to core/src/main/java/io/squashql/query/database/SqlFunctions.java
index 8c89519..27420e1 100644
--- a/core/src/main/java/io/squashql/query/database/SQLFunctions.java
+++ b/core/src/main/java/io/squashql/query/database/SqlFunctions.java
@@ -2,11 +2,11 @@ package io.squashql.query.database;
 
 import java.util.Set;
 
-public final class SQLFunctions {
+public final class SqlFunctions {
 
   public static final Set<String> SUPPORTED_DATE_FUNCTIONS = Set.of("YEAR", "QUARTER", "MONTH");
   public static final Set<String> SUPPORTED_STRING_FUNCTIONS = Set.of("lower", "upper");
 
-  private SQLFunctions() {
+  private SqlFunctions() {
   }
 }
diff --git a/core/src/main/java/io/squashql/query/database/SQLTranslator.java b/core/src/main/java/io/squashql/query/database/SqlTranslator.java
similarity index 99%
rename from core/src/main/java/io/squashql/query/database/SQLTranslator.java
rename to core/src/main/java/io/squashql/query/database/SqlTranslator.java
index 1a52804..847a33c 100644
--- a/core/src/main/java/io/squashql/query/database/SQLTranslator.java
+++ b/core/src/main/java/io/squashql/query/database/SqlTranslator.java
@@ -14,7 +14,7 @@ import java.util.Set;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
-public class SQLTranslator {
+public class SqlTranslator {
 
   public static final String TOTAL_CELL = "___total___";
 
diff --git a/core/src/main/java/io/squashql/query/dictionary/ObjectArrayDictionary.java b/core/src/main/java/io/squashql/query/dictionary/ObjectArrayDictionary.java
index 1807689..86ccf2c 100644
--- a/core/src/main/java/io/squashql/query/dictionary/ObjectArrayDictionary.java
+++ b/core/src/main/java/io/squashql/query/dictionary/ObjectArrayDictionary.java
@@ -9,7 +9,7 @@ import java.util.Arrays;
 public class ObjectArrayDictionary {
 
   /**
-   * The value to indicate no value
+   * The value to indicate that no value is present.
    */
   private static final int FREE = -1;
 
@@ -44,10 +44,6 @@ public class ObjectArrayDictionary {
     return this.underlyingDic.getIfAbsent(key, FREE);
   }
 
-  public int getPointLength() {
-    return this.pointLength;
-  }
-
   public int size() {
     return this.underlyingDic.size();
   }
@@ -57,9 +53,8 @@ public class ObjectArrayDictionary {
   }
 
   private static final class ObjectArrayHashingStrategy implements HashingStrategy<Object[]> {
-    private static final long serialVersionUID = 1L;
 
-    private static HashingStrategy<Object[]> INSTANCE = new ObjectArrayHashingStrategy();
+    private static final HashingStrategy<Object[]> INSTANCE = new ObjectArrayHashingStrategy();
 
     @Override
     public int computeHashCode(Object[] object) {
diff --git a/core/src/main/java/io/squashql/query/join/ExperimentalQueryJoinExecutor.java b/core/src/main/java/io/squashql/query/join/ExperimentalQueryJoinExecutor.java
index 18516cc..46ed21a 100644
--- a/core/src/main/java/io/squashql/query/join/ExperimentalQueryJoinExecutor.java
+++ b/core/src/main/java/io/squashql/query/join/ExperimentalQueryJoinExecutor.java
@@ -21,7 +21,7 @@ import java.util.stream.Collectors;
 
 import static io.squashql.query.QueryExecutor.LIMIT_DEFAULT_VALUE;
 import static io.squashql.query.database.AQueryEngine.transformToColumnFormat;
-import static io.squashql.query.database.SQLTranslator.addLimit;
+import static io.squashql.query.database.SqlTranslator.addLimit;
 
 @Slf4j
 @AllArgsConstructor
@@ -45,7 +45,7 @@ public class ExperimentalQueryJoinExecutor {
       this.dbQuery = new DatabaseQuery(this.queryResolver.getScope().copyWithNewLimit(-1), new ArrayList<>(this.queryResolver.getMeasures().values()));
       this.queryRewriter = ExperimentalQueryJoinExecutor.this.queryEngine.queryRewriter();
       this.originalTableName = query.table != null ? query.table.name : null;
-      this.sql = SQLTranslator.translate(this.dbQuery, this.queryRewriter);
+      this.sql = SqlTranslator.translate(this.dbQuery, this.queryRewriter);
     }
   }
 
@@ -329,7 +329,7 @@ public class ExperimentalQueryJoinExecutor {
         orderBy.add(new CompiledOrderBy(typedField, e.getValue()));
       }
     }
-    SQLTranslator.addOrderBy(sb, orderBy, queryRewriter);
+    SqlTranslator.addOrderBy(sb, orderBy, queryRewriter);
   }
 
   private static CriteriaDto rewriteJoinCondition(CriteriaDto joinCondition, List<Holder> holders) {
diff --git a/core/src/main/java/io/squashql/query/measure/Repository.java b/core/src/main/java/io/squashql/query/measure/Repository.java
index b36b676..c1e0a1c 100644
--- a/core/src/main/java/io/squashql/query/measure/Repository.java
+++ b/core/src/main/java/io/squashql/query/measure/Repository.java
@@ -1,7 +1,7 @@
 package io.squashql.query.measure;
 
 import com.fasterxml.jackson.databind.JavaType;
-import io.squashql.jackson.SquashQLTypeFactory;
+import io.squashql.jackson.JacksonUtil;
 import io.squashql.query.Axis;
 import io.squashql.query.Field;
 import io.squashql.query.Measure;
@@ -56,11 +56,11 @@ public final class Repository {
    * Boolean -> is mandatory?
    */
   public static List<Triple<String, JavaType, Boolean>> getParameterTypes(String key) {
-    JavaType fieldJT = SquashQLTypeFactory.of(Field.class);
-    JavaType doubleJT = SquashQLTypeFactory.of(double.class);
-    JavaType listOfFieldsJT = SquashQLTypeFactory.listOf(Field.class);
-    JavaType axis = SquashQLTypeFactory.of(Axis.class);
-    JavaType str = SquashQLTypeFactory.of(String.class);
+    JavaType fieldJT = JacksonUtil.getJavaType(Field.class);
+    JavaType doubleJT = JacksonUtil.getJavaType(double.class);
+    JavaType listOfFieldsJT = JacksonUtil.getListJavaType(Field.class);
+    JavaType axis = JacksonUtil.getJavaType(Axis.class);
+    JavaType str = JacksonUtil.getJavaType(String.class);
     if (key.equals(VAR)) {
       return List.of(Tuples.triple("value", fieldJT, true), Tuples.triple("date", fieldJT, true), Tuples.triple("quantile", doubleJT, true), Tuples.triple("return", str, true));
     } else if (key.equals(INCREMENTAL_VAR)) {
diff --git a/core/src/main/java/io/squashql/query/comp/BinaryOperations.java b/core/src/main/java/io/squashql/query/util/BinaryOperations.java
similarity index 99%
rename from core/src/main/java/io/squashql/query/comp/BinaryOperations.java
rename to core/src/main/java/io/squashql/query/util/BinaryOperations.java
index a32bee4..6f4c265 100644
--- a/core/src/main/java/io/squashql/query/comp/BinaryOperations.java
+++ b/core/src/main/java/io/squashql/query/util/BinaryOperations.java
@@ -1,4 +1,4 @@
-package io.squashql.query.comp;
+package io.squashql.query.util;
 
 import io.squashql.query.BinaryOperator;
 import io.squashql.query.ComparisonMethod;
diff --git a/core/src/main/java/io/squashql/table/MergeTables.java b/core/src/main/java/io/squashql/table/MergeTables.java
index b439e0f..911134a 100644
--- a/core/src/main/java/io/squashql/table/MergeTables.java
+++ b/core/src/main/java/io/squashql/table/MergeTables.java
@@ -4,7 +4,7 @@ import com.google.common.collect.Iterables;
 import com.google.common.collect.Sets;
 import io.squashql.query.Header;
 import io.squashql.query.compiled.CompiledMeasure;
-import io.squashql.query.database.SQLTranslator;
+import io.squashql.query.database.SqlTranslator;
 import io.squashql.query.dictionary.ObjectArrayDictionary;
 import io.squashql.query.dto.JoinType;
 import org.eclipse.collections.api.list.primitive.IntList;
@@ -121,7 +121,7 @@ public class MergeTables {
     final int[] position = {-1};
 
     leftTable.pointDictionary().forEach((point, row) -> {
-      Arrays.fill(mergedBuffer, SQLTranslator.TOTAL_CELL);
+      Arrays.fill(mergedBuffer, SqlTranslator.TOTAL_CELL);
       for (int i = 0; i < point.length; i++) {
         mergedBuffer[leftMapping[i]] = point[i];
       }
@@ -145,7 +145,7 @@ public class MergeTables {
       int[] complement = complement(holder.leftMapping, holder.rightMapping);
       boolean missingColumnsAreTotal = true;
       for (int c : complement) {
-        missingColumnsAreTotal &= SQLTranslator.TOTAL_CELL.equals(mergedBuffer[c]);
+        missingColumnsAreTotal &= SqlTranslator.TOTAL_CELL.equals(mergedBuffer[c]);
       }
 
       boolean pointExistInRightTable = (position[0] = rightTable.pointDictionary().getPosition(rightBuffer)) >= 0;
@@ -167,7 +167,7 @@ public class MergeTables {
       if (alreadyVisited.get(row)) {
         return;
       }
-      Arrays.fill(mergedBuffer, SQLTranslator.TOTAL_CELL);
+      Arrays.fill(mergedBuffer, SqlTranslator.TOTAL_CELL);
       for (int i = 0; i < point.length; i++) {
         mergedBuffer[rightMapping[i]] = point[i];
       }
diff --git a/core/src/main/java/io/squashql/table/TableUtils.java b/core/src/main/java/io/squashql/table/TableUtils.java
index 3baf790..f8d6794 100644
--- a/core/src/main/java/io/squashql/table/TableUtils.java
+++ b/core/src/main/java/io/squashql/table/TableUtils.java
@@ -8,7 +8,7 @@ import io.squashql.query.QueryExecutor;
 import io.squashql.query.compiled.CompiledMeasure;
 import io.squashql.query.database.QueryEngine;
 import io.squashql.query.database.QueryScope;
-import io.squashql.query.database.SQLTranslator;
+import io.squashql.query.database.SqlTranslator;
 import io.squashql.query.database.SqlUtils;
 import io.squashql.query.dto.GroupColumnSetDto;
 import io.squashql.query.dto.MetadataItem;
@@ -228,7 +228,7 @@ public class TableUtils {
   }
 
   /**
-   * Replaces cell values containing {@link SQLTranslator#TOTAL_CELL} with {@link QueryEngine#GRAND_TOTAL} or
+   * Replaces cell values containing {@link SqlTranslator#TOTAL_CELL} with {@link QueryEngine#GRAND_TOTAL} or
    * {@link QueryEngine#TOTAL}.
    */
   public static Table replaceTotalCellValues(ColumnarTable table, boolean hasTotal) {
@@ -253,7 +253,7 @@ public class TableUtils {
       for (int i = 0; i < table.headers().size(); i++) {
         Header header = table.headers().get(i);
         if (!header.isMeasure()) {
-          boolean isTotalCell = SQLTranslator.TOTAL_CELL.equals(table.getColumn(i).get(rowIndex));
+          boolean isTotalCell = SqlTranslator.TOTAL_CELL.equals(table.getColumn(i).get(rowIndex));
           if (isTotalCell) {
             finalTable.get().getColumn(i).set(rowIndex, total);
           }
@@ -288,7 +288,7 @@ public class TableUtils {
 
   /**
    * Changes the content of the input table to remove columns corresponding to grouping() (columns that help to identify
-   * rows containing totals) and write {@link SQLTranslator#TOTAL_CELL} in the corresponding cells. The input table is
+   * rows containing totals) and write {@link SqlTranslator#TOTAL_CELL} in the corresponding cells. The input table is
    * <b>NOT</b> modified, a copy is created instead.
    * <pre>
    *   Input:
@@ -334,7 +334,7 @@ public class TableUtils {
             if (o != null && ((Number) o).longValue() == 1) {
               // It is a total if == 1. It is cast as Number because the type is Byte with Spark, Long with
               // ClickHouse...
-              baseColumnValues.set(rowIndex, SQLTranslator.TOTAL_CELL);
+              baseColumnValues.set(rowIndex, SqlTranslator.TOTAL_CELL);
             }
           }
         }
diff --git a/core/src/main/java/io/squashql/type/FunctionTypedField.java b/core/src/main/java/io/squashql/type/FunctionTypedField.java
index f75fb48..8bd3006 100644
--- a/core/src/main/java/io/squashql/type/FunctionTypedField.java
+++ b/core/src/main/java/io/squashql/type/FunctionTypedField.java
@@ -3,8 +3,8 @@ package io.squashql.type;
 import io.squashql.query.database.QueryRewriter;
 import io.squashql.store.UnknownType;
 
-import static io.squashql.query.database.SQLFunctions.SUPPORTED_DATE_FUNCTIONS;
-import static io.squashql.query.database.SQLFunctions.SUPPORTED_STRING_FUNCTIONS;
+import static io.squashql.query.database.SqlFunctions.SUPPORTED_DATE_FUNCTIONS;
+import static io.squashql.query.database.SqlFunctions.SUPPORTED_STRING_FUNCTIONS;
 
 public record FunctionTypedField(TypedField field, String function, String alias) implements TypedField {
 
diff --git a/core/src/main/java/io/squashql/util/NullAndTotalComparator.java b/core/src/main/java/io/squashql/util/NullAndTotalComparator.java
index 194dfd8..526a2ec 100644
--- a/core/src/main/java/io/squashql/util/NullAndTotalComparator.java
+++ b/core/src/main/java/io/squashql/util/NullAndTotalComparator.java
@@ -5,7 +5,7 @@ import java.util.Comparator;
 
 import static io.squashql.query.database.QueryEngine.GRAND_TOTAL;
 import static io.squashql.query.database.QueryEngine.TOTAL;
-import static io.squashql.query.database.SQLTranslator.TOTAL_CELL;
+import static io.squashql.query.database.SqlTranslator.TOTAL_CELL;
 
 public class NullAndTotalComparator<T> implements Comparator<T>, Serializable {
 
diff --git a/js/typescript-library/package-lock.json b/js/typescript-library/package-lock.json
index 5ae185e..e6226c4 100644
--- a/js/typescript-library/package-lock.json
+++ b/js/typescript-library/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "@squashql/squashql-js",
-  "version": "1.18.1",
+  "version": "1.18.2",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "@squashql/squashql-js",
-      "version": "1.18.1",
+      "version": "1.18.2",
       "license": "Apache-2.0",
       "dependencies": {
         "axios": "^1.6.8"
diff --git a/postgresql/src/main/java/io/squashql/query/database/PostgreSQLQueryRewriter.java b/postgresql/src/main/java/io/squashql/query/database/PostgreSQLQueryRewriter.java
index 3a61bc9..8457d76 100644
--- a/postgresql/src/main/java/io/squashql/query/database/PostgreSQLQueryRewriter.java
+++ b/postgresql/src/main/java/io/squashql/query/database/PostgreSQLQueryRewriter.java
@@ -40,7 +40,7 @@ class PostgreSQLQueryRewriter implements QueryRewriter {
   public String functionExpression(FunctionTypedField ftf) {
     if ("current_date".contains(ftf.function())) {
       return "CURRENT_DATE";
-    } else if (SQLFunctions.SUPPORTED_DATE_FUNCTIONS.contains(ftf.function())) {
+    } else if (SqlFunctions.SUPPORTED_DATE_FUNCTIONS.contains(ftf.function())) {
       return String.format("extract(%s from %s)", ftf.function(), ftf.field().sqlExpression(this));
     } else {
       return QueryRewriter.super.functionExpression(ftf);


Test patch:
diff --git a/core/src/test/java/io/squashql/query/ATestQueryCache.java b/core/src/test/java/io/squashql/query/ATestQueryCache.java
index c41d136..246630f 100644
--- a/core/src/test/java/io/squashql/query/ATestQueryCache.java
+++ b/core/src/test/java/io/squashql/query/ATestQueryCache.java
@@ -3,6 +3,8 @@ package io.squashql.query;
 import io.squashql.TestClass;
 import io.squashql.query.agg.AggregationFunction;
 import io.squashql.query.builder.Query;
+import io.squashql.query.cache.CaffeineQueryCache;
+import io.squashql.query.cache.GlobalCache;
 import io.squashql.query.dto.*;
 import io.squashql.query.parameter.QueryCacheParameter;
 import io.squashql.table.Table;
diff --git a/core/src/test/java/io/squashql/query/ATestVectorAggregation.java b/core/src/test/java/io/squashql/query/ATestVectorAggregation.java
index 66e3802..ebe679b 100644
--- a/core/src/test/java/io/squashql/query/ATestVectorAggregation.java
+++ b/core/src/test/java/io/squashql/query/ATestVectorAggregation.java
@@ -2,6 +2,7 @@ package io.squashql.query;
 
 import io.squashql.TestClass;
 import io.squashql.query.builder.Query;
+import io.squashql.query.cache.GlobalCache;
 import io.squashql.query.database.SqlUtils;
 import io.squashql.query.dictionary.ObjectArrayDictionary;
 import io.squashql.query.dto.PivotTableQueryDto;
diff --git a/core/src/test/java/io/squashql/query/TestSQLTranslator.java b/core/src/test/java/io/squashql/query/TestSqlTranslator.java
similarity index 99%
rename from core/src/test/java/io/squashql/query/TestSQLTranslator.java
rename to core/src/test/java/io/squashql/query/TestSqlTranslator.java
index 9823a15..e25cef4 100644
--- a/core/src/test/java/io/squashql/query/TestSQLTranslator.java
+++ b/core/src/test/java/io/squashql/query/TestSqlTranslator.java
@@ -23,7 +23,7 @@ import static io.squashql.query.dto.JoinType.LEFT;
 import static io.squashql.transaction.DataLoader.SCENARIO_FIELD_NAME;
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class TestSQLTranslator {
+public class TestSqlTranslator {
 
   private static final String BASE_STORE_NAME = "baseStore";
 
@@ -118,7 +118,7 @@ public class TestSQLTranslator {
   }
 
   public static String translate(DatabaseQuery query) {
-    return SQLTranslator.translate(query, new SQLTranslatorQueryRewriter());
+    return SqlTranslator.translate(query, new SQLTranslatorQueryRewriter());
   }
 
   private DatabaseQuery compileQuery(QueryDto query) {
diff --git a/core/src/test/java/io/squashql/table/TestMergeThreeTables.java b/core/src/test/java/io/squashql/table/TestMergeThreeTables.java
index 9fe6f36..f3ad450 100644
--- a/core/src/test/java/io/squashql/table/TestMergeThreeTables.java
+++ b/core/src/test/java/io/squashql/table/TestMergeThreeTables.java
@@ -14,7 +14,7 @@ import java.util.Set;
 
 import static io.squashql.query.agg.AggregationFunction.AVG;
 import static io.squashql.query.agg.AggregationFunction.SUM;
-import static io.squashql.query.database.SQLTranslator.TOTAL_CELL;
+import static io.squashql.query.database.SqlTranslator.TOTAL_CELL;
 import static io.squashql.table.ATestMergeTables.orderRows;
 
 class TestMergeThreeTables {
diff --git a/core/src/test/java/io/squashql/util/TestUtil.java b/core/src/test/java/io/squashql/util/TestUtil.java
index 8bfa81c..c1915b9 100644
--- a/core/src/test/java/io/squashql/util/TestUtil.java
+++ b/core/src/test/java/io/squashql/util/TestUtil.java
@@ -2,9 +2,9 @@ package io.squashql.util;
 
 import com.google.common.collect.ImmutableList;
 import io.squashql.jackson.JacksonUtil;
-import io.squashql.query.GlobalCache;
 import io.squashql.query.Header;
 import io.squashql.query.SquashQLUser;
+import io.squashql.query.cache.GlobalCache;
 import io.squashql.query.compiled.CompiledMeasure;
 import io.squashql.query.dto.CacheStatsDto;
 import io.squashql.query.dto.SimpleTableDto;