You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ja...@apache.org on 2017/10/20 07:11:47 UTC

carbondata git commit: [CARBONDATA-1512] Fixed bug for failing of concurrently executing sql queries in presto

Repository: carbondata
Updated Branches:
  refs/heads/master 9326cfdc0 -> 7036696e2


[CARBONDATA-1512] Fixed bug for failing of concurrently executing sql queries in presto

Resolved concurrent query execution failure

This closes #1388


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/7036696e
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/7036696e
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/7036696e

Branch: refs/heads/master
Commit: 7036696e26973f7bb5b79ca122535efc757dc3e9
Parents: 9326cfd
Author: Geetika Gupta <ge...@knoldus.in>
Authored: Wed Sep 27 15:04:58 2017 +0530
Committer: Jacky Li <ja...@qq.com>
Committed: Fri Oct 20 15:10:56 2017 +0800

----------------------------------------------------------------------
 .../carbondata/presto/impl/CarbonTableReader.java | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/7036696e/integration/presto/src/main/java/org/apache/carbondata/presto/impl/CarbonTableReader.java
----------------------------------------------------------------------
diff --git a/integration/presto/src/main/java/org/apache/carbondata/presto/impl/CarbonTableReader.java b/integration/presto/src/main/java/org/apache/carbondata/presto/impl/CarbonTableReader.java
index 5c00026..0fa7684 100755
--- a/integration/presto/src/main/java/org/apache/carbondata/presto/impl/CarbonTableReader.java
+++ b/integration/presto/src/main/java/org/apache/carbondata/presto/impl/CarbonTableReader.java
@@ -99,6 +99,7 @@ public class CarbonTableReader {
   @Inject public CarbonTableReader(CarbonTableConfig config) {
     this.config = requireNonNull(config, "CarbonTableConfig is null");
     this.cc = new ConcurrentHashMap<>();
+    tableList = new LinkedList<>();
   }
 
   /**
@@ -121,7 +122,7 @@ public class CarbonTableReader {
           }
         }
       }
-      updateSchemaTables();
+      updateSchemaTables(table);
       parseCarbonMetadata(table);
     }
 
@@ -207,7 +208,7 @@ public class CarbonTableReader {
    */
   public CarbonTable getTable(SchemaTableName schemaTableName) {
     try {
-      updateSchemaTables();
+      updateSchemaTables(schemaTableName);
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
@@ -223,16 +224,17 @@ public class CarbonTableReader {
    * and cache all the table names in this.tableList. Notice that whenever this method
    * is called, it clears this.tableList and populate the list by reading the files.
    */
-  private void updateSchemaTables() {
+  private void updateSchemaTables(SchemaTableName schemaTableName) {
     // update logic determine later
     if (carbonFileList == null) {
       updateSchemaList();
     }
-    tableList = new LinkedList<>();
-    for (CarbonFile cf : carbonFileList.listFiles()) {
-      if (!cf.getName().endsWith(".mdt")) {
-        for (CarbonFile table : cf.listFiles()) {
-          tableList.add(new SchemaTableName(cf.getName(), table.getName()));
+    if(!tableList.contains(schemaTableName)) {
+      for (CarbonFile cf : carbonFileList.listFiles()) {
+        if (!cf.getName().endsWith(".mdt")) {
+          for (CarbonFile table : cf.listFiles()) {
+            tableList.add(new SchemaTableName(cf.getName(), table.getName()));
+          }
         }
       }
     }