This is an automated email from the ASF dual-hosted git repository.

bchapuis pushed a commit to branch mbtiles-perf
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git

commit 7ddcc4f4dc1153f16ed29751f12a95c7f588da52
Author: Bertil Chapuis <[email protected]>
AuthorDate: Tue Aug 22 14:20:54 2023 +0200

    Cache sql ast
---
 .../java/org/apache/baremaps/tilestore/postgres/PostgresQuery.java    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/tilestore/postgres/PostgresQuery.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/tilestore/postgres/PostgresQuery.java
index 5047ace8..542ca854 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/tilestore/postgres/PostgresQuery.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/tilestore/postgres/PostgresQuery.java
@@ -29,6 +29,7 @@ public class PostgresQuery {
   private final Integer minzoom;
   private final Integer maxzoom;
   private final String sql;
+  private final PlainSelect ast;
 
   /**
    * Constructs a {@code PostgresQuery}.
@@ -43,6 +44,7 @@ public class PostgresQuery {
     this.minzoom = minzoom;
     this.maxzoom = maxzoom;
     this.sql = sql;
+    this.ast = parse(sql);
   }
 
   /**
@@ -87,7 +89,7 @@ public class PostgresQuery {
    * @return the AST
    */
   public PlainSelect getAst() {
-    return parse(sql);
+    return ast;
   }
 
   private PlainSelect parse(String query) {

Reply via email to