You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2023/04/13 07:06:19 UTC

[iotdb] branch optimize_create_stmt created (now c0eaba9b9f)

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

xingtanzjr pushed a change to branch optimize_create_stmt
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at c0eaba9b9f fake optimization for createStmt to decrease new partialpath

This branch includes the following new commits:

     new c0eaba9b9f fake optimization for createStmt to decrease new partialpath

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: fake optimization for createStmt to decrease new partialpath

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xingtanzjr pushed a commit to branch optimize_create_stmt
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit c0eaba9b9fa73a57241c1a037e0b07dec0ac48e5
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Tue Apr 11 21:06:06 2023 +0800

    fake optimization for createStmt to decrease new partialpath
---
 .../apache/iotdb/db/mpp/plan/parser/StatementGenerator.java    | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/StatementGenerator.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/StatementGenerator.java
index ccd650336d..04fe5ff024 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/StatementGenerator.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/parser/StatementGenerator.java
@@ -105,12 +105,16 @@ import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 /** Convert SQL and RPC requests to {@link Statement}. */
 public class StatementGenerator {
   private static final PerformanceOverviewMetrics PERFORMANCE_OVERVIEW_METRICS =
       PerformanceOverviewMetrics.getInstance();
 
+  private static final ConcurrentHashMap<String, PartialPath> partialPathCache =
+      new ConcurrentHashMap<>();
+
   public static Statement createStatement(String sql, ZoneId zoneId) {
     return invokeParser(sql, zoneId);
   }
@@ -348,7 +352,11 @@ public class StatementGenerator {
     List<InsertRowStatement> insertRowStatementList = new ArrayList<>();
     for (int i = 0; i < req.prefixPaths.size(); i++) {
       InsertRowStatement statement = new InsertRowStatement();
-      statement.setDevicePath(new PartialPath(req.getPrefixPaths().get(i)));
+      String prefix = req.getPrefixPaths().get(i);
+      if (!partialPathCache.containsKey(prefix)) {
+        partialPathCache.put(prefix, new PartialPath(prefix));
+      }
+      statement.setDevicePath(partialPathCache.get(prefix));
       statement.setMeasurements(req.getMeasurementsList().get(i).toArray(new String[0]));
       statement.setTime(req.getTimestamps().get(i));
       statement.fillValues(req.valuesList.get(i));