carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [45/50] carbondata git commit: [CARBONDATA-2753] Fix Compatibility issues
Date Mon, 30 Jul 2018 18:43:11 GMT
[CARBONDATA-2753] Fix Compatibility issues

Dictionary path is set to the AbsolteTableIdentifier. So that the child tables/dependent tables
can use the dictionary path of parent/own

This closes #2530


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

Branch: refs/heads/branch-1.4
Commit: b6f1258f81c8d2669d53de786266cbbbace02b5b
Parents: e23aea7
Author: dhatchayani <dhatcha.official@gmail.com>
Authored: Thu Jul 19 19:13:24 2018 +0530
Committer: ravipesala <ravi.pesala@gmail.com>
Committed: Tue Jul 31 00:11:26 2018 +0530

----------------------------------------------------------------------
 .../core/metadata/AbsoluteTableIdentifier.java  | 12 ++++++++
 .../core/metadata/schema/table/CarbonTable.java |  6 +++-
 .../carbondata/core/scan/filter/FilterUtil.java | 29 ++++++++------------
 .../TestBlockletDataMapFactory.java             |  6 ++++
 4 files changed, 34 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/b6f1258f/core/src/main/java/org/apache/carbondata/core/metadata/AbsoluteTableIdentifier.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/AbsoluteTableIdentifier.java
b/core/src/main/java/org/apache/carbondata/core/metadata/AbsoluteTableIdentifier.java
index 3ea1f60..4cd33f6 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/AbsoluteTableIdentifier.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/AbsoluteTableIdentifier.java
@@ -36,6 +36,11 @@ public class AbsoluteTableIdentifier implements Serializable {
    */
   private String tablePath;
 
+  /**
+   * dictionary path of the table
+   */
+  private String dictionaryPath;
+
 
   /**
    * carbon table identifier which will have table name and table database
@@ -146,4 +151,11 @@ public class AbsoluteTableIdentifier implements Serializable {
     return carbonTableIdentifier.toString();
   }
 
+  public String getDictionaryPath() {
+    return dictionaryPath;
+  }
+
+  public void setDictionaryPath(String dictionaryPath) {
+    this.dictionaryPath = dictionaryPath;
+  }
 }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/b6f1258f/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java
b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java
index 995f943..850a791 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java
@@ -805,7 +805,11 @@ public class CarbonTable implements Serializable {
    * @return absolute table identifier
    */
   public AbsoluteTableIdentifier getAbsoluteTableIdentifier() {
-    return tableInfo.getOrCreateAbsoluteTableIdentifier();
+    AbsoluteTableIdentifier absoluteTableIdentifier =
+        tableInfo.getOrCreateAbsoluteTableIdentifier();
+    absoluteTableIdentifier.setDictionaryPath(
+        tableInfo.getFactTable().getTableProperties().get(CarbonCommonConstants.DICTIONARY_PATH));
+    return absoluteTableIdentifier;
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/carbondata/blob/b6f1258f/core/src/main/java/org/apache/carbondata/core/scan/filter/FilterUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/filter/FilterUtil.java b/core/src/main/java/org/apache/carbondata/core/scan/filter/FilterUtil.java
index 0587b33..bae608f 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/filter/FilterUtil.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/filter/FilterUtil.java
@@ -56,12 +56,10 @@ import org.apache.carbondata.core.keygenerator.KeyGenerator;
 import org.apache.carbondata.core.keygenerator.factory.KeyGeneratorFactory;
 import org.apache.carbondata.core.keygenerator.mdkey.MultiDimKeyVarLengthGenerator;
 import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
-import org.apache.carbondata.core.metadata.CarbonMetadata;
 import org.apache.carbondata.core.metadata.ColumnIdentifier;
 import org.apache.carbondata.core.metadata.datatype.DataType;
 import org.apache.carbondata.core.metadata.datatype.DataTypes;
 import org.apache.carbondata.core.metadata.encoder.Encoding;
-import org.apache.carbondata.core.metadata.schema.table.CarbonTable;
 import org.apache.carbondata.core.metadata.schema.table.column.CarbonColumn;
 import org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension;
 import org.apache.carbondata.core.metadata.schema.table.column.CarbonMeasure;
@@ -1386,22 +1384,17 @@ public final class FilterUtil {
       CarbonDimension carbonDimension) throws IOException {
     String dictionaryPath = null;
     ColumnIdentifier columnIdentifier = carbonDimension.getColumnIdentifier();
-    CarbonTable carbonTable = CarbonMetadata.getInstance()
-        .getCarbonTable(dictionarySourceAbsoluteTableIdentifier.getDatabaseName(),
-            dictionarySourceAbsoluteTableIdentifier.getTableName());
-    if (null != carbonTable) {
-      dictionaryPath = carbonTable.getTableInfo().getFactTable().getTableProperties()
-          .get(CarbonCommonConstants.DICTIONARY_PATH);
-      if (null != carbonDimension.getColumnSchema().getParentColumnTableRelations()
-          && carbonDimension.getColumnSchema().getParentColumnTableRelations().size()
== 1) {
-        dictionarySourceAbsoluteTableIdentifier = QueryUtil
-            .getTableIdentifierForColumn(carbonDimension);
-        columnIdentifier = new ColumnIdentifier(
-            carbonDimension.getColumnSchema().getParentColumnTableRelations().get(0).getColumnId(),
-            carbonDimension.getColumnProperties(), carbonDimension.getDataType());
-      } else {
-        dictionarySourceAbsoluteTableIdentifier = carbonTable.getAbsoluteTableIdentifier();
-      }
+    String dicPath = dictionarySourceAbsoluteTableIdentifier.getDictionaryPath();
+    if (null != dicPath && !dicPath.trim().isEmpty()) {
+      dictionaryPath = dicPath;
+    }
+    if (null != carbonDimension.getColumnSchema().getParentColumnTableRelations()
+        && carbonDimension.getColumnSchema().getParentColumnTableRelations().size()
== 1) {
+      dictionarySourceAbsoluteTableIdentifier =
+          QueryUtil.getTableIdentifierForColumn(carbonDimension);
+      columnIdentifier = new ColumnIdentifier(
+          carbonDimension.getColumnSchema().getParentColumnTableRelations().get(0).getColumnId(),
+          carbonDimension.getColumnProperties(), carbonDimension.getDataType());
     }
     DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier =
         new DictionaryColumnUniqueIdentifier(dictionarySourceAbsoluteTableIdentifier,

http://git-wip-us.apache.org/repos/asf/carbondata/blob/b6f1258f/core/src/test/java/org/apache/carbondata/core/indexstore/blockletindex/TestBlockletDataMapFactory.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/indexstore/blockletindex/TestBlockletDataMapFactory.java
b/core/src/test/java/org/apache/carbondata/core/indexstore/blockletindex/TestBlockletDataMapFactory.java
index 8c234b5..d2a6f18 100644
--- a/core/src/test/java/org/apache/carbondata/core/indexstore/blockletindex/TestBlockletDataMapFactory.java
+++ b/core/src/test/java/org/apache/carbondata/core/indexstore/blockletindex/TestBlockletDataMapFactory.java
@@ -77,6 +77,12 @@ public class TestBlockletDataMapFactory {
             UUID.randomUUID().toString());
     Deencapsulation.setField(tableInfo, "identifier", absoluteTableIdentifier);
     Deencapsulation.setField(carbonTable, "tableInfo", tableInfo);
+    new MockUp<CarbonTable>() {
+      @Mock
+      public AbsoluteTableIdentifier getAbsoluteTableIdentifier(){
+        return absoluteTableIdentifier;
+      }
+    };
     blockletDataMapFactory = new BlockletDataMapFactory(carbonTable, new DataMapSchema());
     Deencapsulation.setField(blockletDataMapFactory, "cache",
         CacheProvider.getInstance().createCache(CacheType.DRIVER_BLOCKLET_DATAMAP));


Mime
View raw message