carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [3/3] carbondata git commit: [CARBONDATA-1844] Add tablePath support when creating table
Date Mon, 04 Dec 2017 06:36:13 GMT
[CARBONDATA-1844] Add tablePath support when creating table

User should be able to specify table path when creating table. This PR supports it.
The tablePath of the table is determined as following steps:

Use the table property 'table_path' specified by user
Use database 's locationUri if it is specified by user in create database command, and concatenate with table name as table path
Use carbon store path and database name and table name to construct a table path

This closes #1603


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

Branch: refs/heads/master
Commit: 2fe7758be1278548f9f321b1b0fc0305488a46cd
Parents: 25c2824
Author: Jacky Li <jacky.likun@qq.com>
Authored: Sun Dec 3 13:42:20 2017 +0800
Committer: ravipesala <ravi.pesala@gmail.com>
Committed: Mon Dec 4 12:05:54 2017 +0530

----------------------------------------------------------------------
 .../core/metadata/AbsoluteTableIdentifier.java  |  25 +++-
 .../core/metadata/CarbonMetadata.java           |   4 +-
 .../metadata/converter/SchemaConverter.java     |   7 +-
 .../ThriftWrapperSchemaConverterImpl.java       |   7 +-
 .../core/metadata/schema/table/CarbonTable.java |  36 +----
 .../core/metadata/schema/table/TableInfo.java   |  41 +-----
 .../core/scan/executor/util/QueryUtil.java      |  23 ++-
 .../core/service/ColumnUniqueIdService.java     |   3 +-
 .../service/impl/ColumnUniqueIdGenerator.java   |   2 +-
 .../apache/carbondata/core/util/CarbonUtil.java |  11 +-
 .../core/util/path/CarbonTablePath.java         | 125 +---------------
 .../DictionaryCacheLoaderImplTest.java          |   2 +-
 .../DictionaryColumnUniqueIdentifierTest.java   |   5 +-
 .../dictionary/ForwardDictionaryCacheTest.java  |   5 +-
 .../dictionary/ReverseDictionaryCacheTest.java  |   5 +-
 .../carbon/AbsoluteTableIdentifierTest.java     |  10 +-
 .../datastore/SegmentTaskIndexStoreTest.java    |  17 +--
 .../reader/CarbonDictionaryReaderImplTest.java  |   6 +-
 ...CarbonDictionarySortIndexReaderImplTest.java |   7 +-
 .../core/scan/filter/FilterUtilTest.java        |  13 +-
 .../CarbonFormatDirectoryStructureTest.java     |   2 +-
 .../writer/CarbonDictionaryWriterImplTest.java  |  14 +-
 ...CarbonDictionarySortIndexWriterImplTest.java |   2 +-
 .../carbondata/hadoop/util/SchemaReader.java    |  10 +-
 .../streaming/CarbonStreamInputFormatTest.java  |  11 +-
 .../streaming/CarbonStreamOutputFormatTest.java |  14 +-
 .../hadoop/test/util/StoreCreator.java          |  14 +-
 .../presto/impl/CarbonTableReader.java          |   4 +-
 .../presto/util/CarbonDataStoreCreator.scala    |   3 +-
 .../DataCompactionCardinalityBoundryTest.scala  |   5 +-
 .../datacompaction/DataCompactionLockTest.scala |   5 +-
 .../testsuite/dataload/TestLoadDataFrame.scala  |  23 ++-
 ...estLoadDataWithHiveSyntaxDefaultFormat.scala |  44 +++++-
 .../iud/DeleteCarbonTableTestCase.scala         |  12 +-
 .../iud/UpdateCarbonTableTestCase.scala         |  22 +--
 .../org/apache/carbondata/api/CarbonStore.scala |   4 +-
 .../carbondata/events/CreateTableEvents.scala   |  12 +-
 .../carbondata/events/DropTableEvents.scala     |   9 +-
 .../org/apache/carbondata/events/Events.scala   |   6 +-
 .../apache/carbondata/spark/CarbonOption.scala  |   8 +-
 .../spark/rdd/CarbonGlobalDictionaryRDD.scala   |   2 -
 .../spark/rdd/CarbonIUDMergerRDD.scala          |   4 +-
 .../carbondata/spark/rdd/CarbonMergerRDD.scala  |   8 +-
 .../carbondata/spark/rdd/CarbonScanRDD.scala    |   8 +-
 .../spark/tasks/DictionaryWriterTask.scala      |   2 +-
 .../carbondata/spark/util/CommonUtil.scala      |   6 +-
 .../spark/util/GlobalDictionaryUtil.scala       |  47 +++---
 .../spark/sql/catalyst/CarbonDDLSqlParser.scala |   5 +-
 .../command/carbonTableSchemaCommon.scala       |  32 ++--
 .../spark/util/CarbonReflectionUtils.scala      |   3 +-
 .../spark/rdd/CarbonDataRDDFactory.scala        |  10 +-
 .../spark/sql/CarbonCatalystOperators.scala     |  42 ------
 .../spark/sql/CarbonDataFrameWriter.scala       |  19 ++-
 .../sql/CarbonDatasourceHadoopRelation.scala    |   7 +-
 .../spark/sql/CarbonDictionaryDecoder.scala     |   6 +-
 .../scala/org/apache/spark/sql/CarbonEnv.scala  |  96 +++++++-----
 .../org/apache/spark/sql/CarbonSource.scala     | 146 +++++++++----------
 .../datamap/CarbonCreateDataMapCommand.scala    |   2 +-
 .../datamap/CarbonDropDataMapCommand.scala      |  14 +-
 .../command/datamap/DataMapListeners.scala      |   4 +-
 .../management/CarbonCleanFilesCommand.scala    |  19 +--
 .../CarbonDeleteLoadByIdCommand.scala           |   4 +-
 .../CarbonDeleteLoadByLoadDateCommand.scala     |   4 +-
 .../management/CarbonLoadDataCommand.scala      |  29 ++--
 .../management/CarbonShowLoadsCommand.scala     |   4 +-
 .../CarbonProjectForDeleteCommand.scala         |  23 +--
 .../CarbonProjectForUpdateCommand.scala         |  56 ++++---
 .../command/mutation/DeleteExecution.scala      |  23 +--
 .../command/mutation/HorizontalCompaction.scala |   3 +-
 .../CreatePreAggregateTableCommand.scala        |  11 +-
 .../schema/CarbonAlterTableRenameCommand.scala  |  13 +-
 .../table/CarbonCreateTableCommand.scala        | 116 +++++++--------
 .../command/table/CarbonDropTableCommand.scala  |  87 ++++-------
 .../strategy/StreamingTableStrategy.scala       |  19 +--
 .../spark/sql/hive/CarbonAnalysisRules.scala    |   7 +-
 .../spark/sql/hive/CarbonFileMetastore.scala    | 125 ++++++----------
 .../spark/sql/hive/CarbonHiveMetaStore.scala    |  42 +++---
 .../execution/command/CarbonHiveCommands.scala  |   6 +-
 .../sql/optimizer/CarbonLateDecodeRule.scala    |  11 +-
 .../sql/parser/CarbonSpark2SqlParser.scala      |   5 +-
 .../spark/sql/parser/CarbonSparkSqlParser.scala |  24 ++-
 .../org/apache/spark/util/AlterTableUtil.scala  |  10 +-
 .../src/main/spark2.1/CarbonSessionState.scala  |   1 +
 .../spark/util/AllDictionaryTestCase.scala      |   3 +-
 .../spark/util/DictionaryTestCaseUtil.scala     |   2 +-
 .../util/ExternalColumnDictionaryTestCase.scala |   8 +-
 .../DataLoadFailAllTypeSortTest.scala           |   4 +-
 .../converter/impl/FieldEncoderFactory.java     |   5 +-
 .../processing/util/CarbonLoaderUtil.java       |  31 +---
 .../carbon/datastore/BlockIndexStoreTest.java   |  12 +-
 .../carbondata/processing/StoreCreator.java     |  12 +-
 .../carbondata/streaming/StreamHandoffRDD.scala |   2 +-
 92 files changed, 767 insertions(+), 995 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/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 603a1c1..6ef2671 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
@@ -44,7 +44,7 @@ public class AbsoluteTableIdentifier implements Serializable {
    */
   private CarbonTableIdentifier carbonTableIdentifier;
 
-  public AbsoluteTableIdentifier(String tablePath, CarbonTableIdentifier carbonTableIdentifier) {
+  private AbsoluteTableIdentifier(String tablePath, CarbonTableIdentifier carbonTableIdentifier) {
     //TODO this should be moved to common place where path handling will be handled
     this.tablePath = FileFactory.getUpdatedFilePath(tablePath);
     isLocalPath = tablePath.startsWith(CarbonCommonConstants.LOCAL_FILE_PREFIX);
@@ -58,11 +58,22 @@ public class AbsoluteTableIdentifier implements Serializable {
     return carbonTableIdentifier;
   }
 
-  public static AbsoluteTableIdentifier from(String tablePath, String dbName, String tableName) {
-    CarbonTableIdentifier identifier = new CarbonTableIdentifier(dbName, tableName, "");
+  public static AbsoluteTableIdentifier from(String tablePath, String dbName, String tableName,
+      String tableId) {
+    CarbonTableIdentifier identifier = new CarbonTableIdentifier(dbName, tableName, tableId);
     return new AbsoluteTableIdentifier(tablePath, identifier);
   }
 
+  public static AbsoluteTableIdentifier from(String tablePath, String dbName, String tableName) {
+    return from(tablePath, dbName, tableName, "");
+  }
+
+  public static AbsoluteTableIdentifier from(
+      String tablePath,
+      CarbonTableIdentifier carbonTableIdentifier) {
+    return new AbsoluteTableIdentifier(tablePath, carbonTableIdentifier);
+  }
+
   public String getTablePath() {
     return tablePath;
   }
@@ -124,4 +135,12 @@ public class AbsoluteTableIdentifier implements Serializable {
   public String uniqueName() {
     return tablePath + "/" + carbonTableIdentifier.toString().toLowerCase();
   }
+
+  public String getDatabaseName() {
+    return carbonTableIdentifier.getDatabaseName();
+  }
+
+  public String getTableName() {
+    return carbonTableIdentifier.getTableName();
+  }
 }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/main/java/org/apache/carbondata/core/metadata/CarbonMetadata.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/CarbonMetadata.java b/core/src/main/java/org/apache/carbondata/core/metadata/CarbonMetadata.java
index e2ce43a..3f8c12d 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/CarbonMetadata.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/CarbonMetadata.java
@@ -86,8 +86,8 @@ public final class CarbonMetadata {
    */
   public void loadTableMetadata(TableInfo tableInfo) {
     CarbonTable carbonTable = tableInfoMap.get(convertToLowerCase(tableInfo.getTableUniqueName()));
-    if (null == carbonTable || carbonTable.getTableLastUpdatedTime() < tableInfo
-        .getLastUpdatedTime()) {
+    if (null == carbonTable ||
+        carbonTable.getTableLastUpdatedTime() < tableInfo.getLastUpdatedTime()) {
       carbonTable = CarbonTable.buildFromTableInfo(tableInfo);
       tableInfoMap.put(convertToLowerCase(tableInfo.getTableUniqueName()), carbonTable);
     }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/main/java/org/apache/carbondata/core/metadata/converter/SchemaConverter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/converter/SchemaConverter.java b/core/src/main/java/org/apache/carbondata/core/metadata/converter/SchemaConverter.java
index af86253..4f34070 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/converter/SchemaConverter.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/converter/SchemaConverter.java
@@ -99,8 +99,11 @@ public interface SchemaConverter {
    * @param tableName
    * @return
    */
-  TableInfo fromExternalToWrapperTableInfo(org.apache.carbondata.format.TableInfo externalTableInfo,
-      String dbName, String tableName, String storePath);
+  TableInfo fromExternalToWrapperTableInfo(
+      org.apache.carbondata.format.TableInfo externalTableInfo,
+      String dbName,
+      String tableName,
+      String storePath);
 
   /**
    * method to convert thrift datamap schema object to wrapper

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/main/java/org/apache/carbondata/core/metadata/converter/ThriftWrapperSchemaConverterImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/converter/ThriftWrapperSchemaConverterImpl.java b/core/src/main/java/org/apache/carbondata/core/metadata/converter/ThriftWrapperSchemaConverterImpl.java
index 408c861..8a24e38 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/converter/ThriftWrapperSchemaConverterImpl.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/converter/ThriftWrapperSchemaConverterImpl.java
@@ -608,14 +608,15 @@ public class ThriftWrapperSchemaConverterImpl implements SchemaConverter {
    * convert from external to wrapper tableinfo
    */
   @Override public TableInfo fromExternalToWrapperTableInfo(
-      org.apache.carbondata.format.TableInfo externalTableInfo, String dbName, String tableName,
+      org.apache.carbondata.format.TableInfo externalTableInfo,
+      String dbName,
+      String tableName,
       String tablePath) {
     TableInfo wrapperTableInfo = new TableInfo();
     List<org.apache.carbondata.format.SchemaEvolutionEntry> schemaEvolutionList =
         externalTableInfo.getFact_table().getSchema_evolution().getSchema_evolution_history();
     wrapperTableInfo.setLastUpdatedTime(
-        schemaEvolutionList.get(schemaEvolutionList.size() - 1)
-            .getTime_stamp());
+        schemaEvolutionList.get(schemaEvolutionList.size() - 1).getTime_stamp());
     wrapperTableInfo.setDatabaseName(dbName);
     wrapperTableInfo.setTableUniqueName(CarbonTable.buildUniqueName(dbName, tableName));
     wrapperTableInfo.setTablePath(tablePath);

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/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 66b747b..e5d8839 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
@@ -33,6 +33,7 @@ import org.apache.carbondata.core.metadata.schema.table.column.CarbonImplicitDim
 import org.apache.carbondata.core.metadata.schema.table.column.CarbonMeasure;
 import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema;
 import org.apache.carbondata.core.util.CarbonUtil;
+import org.apache.carbondata.core.util.path.CarbonTablePath;
 
 /**
  * Mapping class for Carbon actual table
@@ -50,11 +51,6 @@ public class CarbonTable implements Serializable {
   private static final long serialVersionUID = 8696507171227156445L;
 
   /**
-   * Absolute table identifier
-   */
-  private AbsoluteTableIdentifier absoluteTableIdentifier;
-
-  /**
    * TableName, Dimensions list. This map will contain allDimensions which are visible
    */
   private Map<String, List<CarbonDimension>> tableDimensionsMap;
@@ -102,11 +98,6 @@ public class CarbonTable implements Serializable {
   private String tableUniqueName;
 
   /**
-   * metadata file path (check if it is really required )
-   */
-  private String metaDataFilepath;
-
-  /**
    * last updated time
    */
   private long tableLastUpdatedTime;
@@ -149,9 +140,6 @@ public class CarbonTable implements Serializable {
     table.blockSize = tableInfo.getTableBlockSizeInMB();
     table.tableLastUpdatedTime = tableInfo.getLastUpdatedTime();
     table.tableUniqueName = tableInfo.getTableUniqueName();
-    table.metaDataFilepath = tableInfo.getMetaDataFilepath();
-    table.absoluteTableIdentifier = tableInfo.getOrCreateAbsoluteTableIdentifier();
-
     table.fillDimensionsAndMeasuresForTables(tableInfo.getFactTable());
     table.fillCreateOrderColumn(tableInfo.getFactTable().getTableName());
     if (tableInfo.getFactTable().getBucketingInfo() != null) {
@@ -343,14 +331,14 @@ public class CarbonTable implements Serializable {
    * @return the databaseName
    */
   public String getDatabaseName() {
-    return absoluteTableIdentifier.getCarbonTableIdentifier().getDatabaseName();
+    return tableInfo.getDatabaseName();
   }
 
   /**
    * @return the tabelName
    */
   public String getTableName() {
-    return absoluteTableIdentifier.getCarbonTableIdentifier().getTableName();
+    return tableInfo.getFactTable().getTableName();
   }
 
   /**
@@ -375,14 +363,14 @@ public class CarbonTable implements Serializable {
    * @return the metaDataFilepath
    */
   public String getMetaDataFilepath() {
-    return metaDataFilepath;
+    return CarbonTablePath.getMetadataPath(getTablePath());
   }
 
   /**
    * @return storepath
    */
   public String getTablePath() {
-    return absoluteTableIdentifier.getTablePath();
+    return tableInfo.getOrCreateAbsoluteTableIdentifier().getTablePath();
   }
 
   /**
@@ -433,16 +421,6 @@ public class CarbonTable implements Serializable {
   }
 
   /**
-   * to get the all dimension of a table
-   *
-   * @param tableName
-   * @return all dimension of a table
-   */
-  public List<CarbonDimension> getImplicitDimensionByTableName(String tableName) {
-    return tableImplicitDimensionsMap.get(tableName);
-  }
-
-  /**
    * This will give user created order column
    *
    * @return
@@ -589,14 +567,14 @@ public class CarbonTable implements Serializable {
    * @return absolute table identifier
    */
   public AbsoluteTableIdentifier getAbsoluteTableIdentifier() {
-    return absoluteTableIdentifier;
+    return tableInfo.getOrCreateAbsoluteTableIdentifier();
   }
 
   /**
    * @return carbon table identifier
    */
   public CarbonTableIdentifier getCarbonTableIdentifier() {
-    return absoluteTableIdentifier.getCarbonTableIdentifier();
+    return tableInfo.getOrCreateAbsoluteTableIdentifier().getCarbonTableIdentifier();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableInfo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableInfo.java b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableInfo.java
index 40ce92d..4deafd4 100644
--- a/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableInfo.java
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableInfo.java
@@ -69,16 +69,11 @@ public class TableInfo implements Serializable, Writable {
   private long lastUpdatedTime;
 
   /**
-   * metadata file path (check if it is really required )
-   */
-  private String metaDataFilepath;
-
-  /**
-   * store location
+   * store location of the table, it will be set in identifier.tablePath also
    */
   private String tablePath;
 
-  // this idenifier is a lazy field which will be created when it is used first time
+  // this identifier is a lazy field which will be created when it is used first time
   private AbsoluteTableIdentifier identifier;
 
   private List<DataMapSchema> dataMapSchemaList;
@@ -162,24 +157,6 @@ public class TableInfo implements Serializable, Writable {
     this.lastUpdatedTime = lastUpdatedTime;
   }
 
-  /**
-   * @return
-   */
-  public String getMetaDataFilepath() {
-    return metaDataFilepath;
-  }
-
-  /**
-   * @param metaDataFilepath
-   */
-  public void setMetaDataFilepath(String metaDataFilepath) {
-    this.metaDataFilepath = metaDataFilepath;
-  }
-
-  public String getTablePath() {
-    return tablePath;
-  }
-
   public void setTablePath(String tablePath) {
     this.tablePath = tablePath;
   }
@@ -258,8 +235,7 @@ public class TableInfo implements Serializable, Writable {
     out.writeUTF(tableUniqueName);
     factTable.write(out);
     out.writeLong(lastUpdatedTime);
-    out.writeUTF(metaDataFilepath);
-    out.writeUTF(tablePath);
+    out.writeUTF(getOrCreateAbsoluteTableIdentifier().getTablePath());
     boolean isChildSchemaExists =
         null != dataMapSchemaList && dataMapSchemaList.size() > 0;
     out.writeBoolean(isChildSchemaExists);
@@ -286,7 +262,6 @@ public class TableInfo implements Serializable, Writable {
     this.factTable = new TableSchema();
     this.factTable.readFields(in);
     this.lastUpdatedTime = in.readLong();
-    this.metaDataFilepath = in.readUTF();
     this.tablePath = in.readUTF();
     boolean isChildSchemaExists = in.readBoolean();
     this.dataMapSchemaList = new ArrayList<>();
@@ -303,11 +278,11 @@ public class TableInfo implements Serializable, Writable {
         dataMapSchemaList.add(dataMapSchema);
       }
     }
-    boolean isParentTableRelationIndentifierExists = in.readBoolean();
-    if (isParentTableRelationIndentifierExists) {
-      short parentTableIndentifiersListSize = in.readShort();
+    boolean isParentTableRelationIdentifierExists = in.readBoolean();
+    if (isParentTableRelationIdentifierExists) {
+      short parentTableIdentifiersListSize = in.readShort();
       this.parentRelationIdentifiers = new ArrayList<>();
-      for (int i = 0; i < parentTableIndentifiersListSize; i++) {
+      for (int i = 0; i < parentTableIdentifiersListSize; i++) {
         RelationIdentifier relationIdentifier = new RelationIdentifier(null, null, null);
         relationIdentifier.readFields(in);
         this.parentRelationIdentifiers.add(relationIdentifier);
@@ -319,7 +294,7 @@ public class TableInfo implements Serializable, Writable {
     if (identifier == null) {
       CarbonTableIdentifier carbontableIdentifier =
           new CarbonTableIdentifier(databaseName, factTable.getTableName(), factTable.getTableId());
-      identifier = new AbsoluteTableIdentifier(tablePath, carbontableIdentifier);
+      identifier = AbsoluteTableIdentifier.from(tablePath, carbontableIdentifier);
     }
     return identifier;
   }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/main/java/org/apache/carbondata/core/scan/executor/util/QueryUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/executor/util/QueryUtil.java b/core/src/main/java/org/apache/carbondata/core/scan/executor/util/QueryUtil.java
index de0711b..b5c56dc 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/executor/util/QueryUtil.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/executor/util/QueryUtil.java
@@ -47,6 +47,7 @@ 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.RelationIdentifier;
 import org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension;
 import org.apache.carbondata.core.metadata.schema.table.column.CarbonMeasure;
 import org.apache.carbondata.core.scan.complextypes.ArrayQueryType;
@@ -408,19 +409,17 @@ public class QueryUtil {
 
   public static AbsoluteTableIdentifier getTableIdentifierForColumn(CarbonDimension carbonDimension,
       AbsoluteTableIdentifier absoluteTableIdentifier) {
-    String parentTableName =
-        carbonDimension.getColumnSchema().getParentColumnTableRelations().get(0)
-            .getRelationIdentifier().getTableName();
-    String parentDatabaseName =
-        carbonDimension.getColumnSchema().getParentColumnTableRelations().get(0)
-            .getRelationIdentifier().getDatabaseName();
-    String parentTableId = carbonDimension.getColumnSchema().getParentColumnTableRelations().get(0)
-        .getRelationIdentifier().getTableId();
-    CarbonTableIdentifier carbonTableIdentifier =
-        new CarbonTableIdentifier(parentDatabaseName, parentTableName, parentTableId);
+    RelationIdentifier relation = carbonDimension.getColumnSchema()
+        .getParentColumnTableRelations()
+        .get(0)
+        .getRelationIdentifier();
+    String parentTableName = relation.getTableName();
+    String parentDatabaseName = relation.getDatabaseName();
+    String parentTableId = relation.getTableId();
     CarbonTablePath carbonTablePath = CarbonStorePath.getCarbonTablePath(absoluteTableIdentifier);
-    String newTablePath = CarbonUtil.getNewTablePath(carbonTablePath, carbonTableIdentifier);
-    return new AbsoluteTableIdentifier(newTablePath, carbonTableIdentifier);
+    String newTablePath = CarbonUtil.getNewTablePath(carbonTablePath, parentTableName);
+    return AbsoluteTableIdentifier.from(newTablePath, parentDatabaseName, parentTableName,
+        parentTableId);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/main/java/org/apache/carbondata/core/service/ColumnUniqueIdService.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/service/ColumnUniqueIdService.java b/core/src/main/java/org/apache/carbondata/core/service/ColumnUniqueIdService.java
index 22b0884..fbaca58 100644
--- a/core/src/main/java/org/apache/carbondata/core/service/ColumnUniqueIdService.java
+++ b/core/src/main/java/org/apache/carbondata/core/service/ColumnUniqueIdService.java
@@ -24,9 +24,8 @@ import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema;
 public interface ColumnUniqueIdService {
 
   /**
-   * @param databaseName
    * @param columnSchema
    * @return generate unique id
    */
-  String generateUniqueId(String databaseName, ColumnSchema columnSchema);
+  String generateUniqueId(ColumnSchema columnSchema);
 }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/main/java/org/apache/carbondata/core/service/impl/ColumnUniqueIdGenerator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/service/impl/ColumnUniqueIdGenerator.java b/core/src/main/java/org/apache/carbondata/core/service/impl/ColumnUniqueIdGenerator.java
index b9821d7..2816e85 100644
--- a/core/src/main/java/org/apache/carbondata/core/service/impl/ColumnUniqueIdGenerator.java
+++ b/core/src/main/java/org/apache/carbondata/core/service/impl/ColumnUniqueIdGenerator.java
@@ -28,7 +28,7 @@ public class ColumnUniqueIdGenerator implements ColumnUniqueIdService {
 
   private static ColumnUniqueIdService columnUniqueIdService = new ColumnUniqueIdGenerator();
 
-  @Override public String generateUniqueId(String databaseName, ColumnSchema columnSchema) {
+  @Override public String generateUniqueId(ColumnSchema columnSchema) {
     return UUID.randomUUID().toString();
   }
 

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java b/core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java
index 1175cf0..1e8bc1f 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java
@@ -60,7 +60,6 @@ import org.apache.carbondata.core.indexstore.BlockletDetailInfo;
 import org.apache.carbondata.core.keygenerator.mdkey.NumberCompressor;
 import org.apache.carbondata.core.locks.ICarbonLock;
 import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
-import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
 import org.apache.carbondata.core.metadata.ColumnarFormatVersion;
 import org.apache.carbondata.core.metadata.ValueEncoderMeta;
 import org.apache.carbondata.core.metadata.blocklet.DataFileFooter;
@@ -2152,14 +2151,14 @@ public final class CarbonUtil {
    * tableName to the parent
    *
    * @param carbonTablePath       Old tablePath
-   * @param carbonTableIdentifier new carbonTableIdentifier
+   * @param newTableName          new table name
    * @return the new table path
    */
-  public static String getNewTablePath(Path carbonTablePath,
-      CarbonTableIdentifier carbonTableIdentifier) {
+  public static String getNewTablePath(
+      Path carbonTablePath,
+      String newTableName) {
     Path parentPath = carbonTablePath.getParent();
-    return parentPath.toString() + CarbonCommonConstants.FILE_SEPARATOR + carbonTableIdentifier
-        .getTableName();
+    return parentPath.toString() + CarbonCommonConstants.FILE_SEPARATOR + newTableName;
   }
 
   /*

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/main/java/org/apache/carbondata/core/util/path/CarbonTablePath.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/util/path/CarbonTablePath.java b/core/src/main/java/org/apache/carbondata/core/util/path/CarbonTablePath.java
index 376a71f..172b71d 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/path/CarbonTablePath.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/path/CarbonTablePath.java
@@ -39,16 +39,12 @@ public class CarbonTablePath extends Path {
   private static final String SORT_INDEX_EXT = ".sortindex";
   private static final String SCHEMA_FILE = "schema";
   private static final String TABLE_STATUS_FILE = "tablestatus";
-  private static final String TABLE_UPDATE_STATUS_FILE = "tableupdatestatus";
   private static final String FACT_DIR = "Fact";
   private static final String SEGMENT_PREFIX = "Segment_";
   private static final String PARTITION_PREFIX = "Part";
   private static final String CARBON_DATA_EXT = ".carbondata";
-  private static final String CARBON_DELTE_DELTA_EXT = ".deletedelta";
-  private static final String CARBON_UPDATE_DELTA_EXT = ".updatedelta";
   private static final String DATA_PART_PREFIX = "part-";
   private static final String BATCH_PREFIX = "_batchno";
-  private static final String DELETE_DELTA_FILE_EXT = ".deletedelta";
 
   public static final String INDEX_FILE_EXT = ".carbonindex";
   public static final String MERGE_INDEX_FILE_EXT = ".carbonindexmerge";
@@ -112,20 +108,6 @@ public class CarbonTablePath extends Path {
     }
     return false;
   }
-  /**
-   * check if it is carbon data file matching extension
-   *
-   * @param fileNameWithPath
-   * @return boolean
-   */
-  public static boolean isCarbonDataFileOrUpdateFile(String fileNameWithPath) {
-    int pos = fileNameWithPath.lastIndexOf('.');
-    if (pos != -1) {
-      return fileNameWithPath.substring(pos).startsWith(CARBON_DATA_EXT) || fileNameWithPath
-          .substring(pos).startsWith(CARBON_UPDATE_DELTA_EXT);
-    }
-    return false;
-  }
 
   /**
    * check if it is carbon index file matching extension
@@ -157,14 +139,6 @@ public class CarbonTablePath extends Path {
   }
 
   /**
-   * @return it return relative directory
-   */
-  public String getRelativeDictionaryDirectory() {
-    return carbonTableIdentifier.getDatabaseName() + File.separator + carbonTableIdentifier
-        .getTableName();
-  }
-
-  /**
    * This method will return the metadata directory location for a table
    *
    * @return
@@ -174,6 +148,13 @@ public class CarbonTablePath extends Path {
   }
 
   /**
+   * Return metadata path based on `tablePath`
+   */
+  public static String getMetadataPath(String tablePath) {
+    return tablePath + File.separator + METADATA_DIR;
+  }
+
+  /**
    * @param columnId unique column identifier
    * @return absolute path of dictionary meta file
    */
@@ -223,13 +204,6 @@ public class CarbonTablePath extends Path {
   }
 
   /**
-   * @return absolute path of table update status file
-   */
-  public String getTableUpdateStatusFilePath() {
-    return getMetaDataDir() + File.separator + TABLE_UPDATE_STATUS_FILE;
-  }
-
-  /**
    * Gets absolute path of data file
    *
    * @param partitionId         unique partition identifier
@@ -322,64 +296,6 @@ public class CarbonTablePath extends Path {
       String factUpdatedtimeStamp) {
     return taskNo + "-" + bucketNumber + "-" + factUpdatedtimeStamp + INDEX_FILE_EXT;
   }
-  /**
-   * Below method will be used to get the index file present in the segment folder
-   * based on task id
-   *
-   * @param taskId      task id of the file
-   * @param partitionId partition number
-   * @param segmentId   segment number
-   * @return full qualified carbon index path
-   */
-  public String getCarbonUpdatedIndexFilePath(final String taskId, final String partitionId,
-      final String segmentId) {
-    String segmentDir = getSegmentDir(partitionId, segmentId);
-    CarbonFile carbonFile =
-        FileFactory.getCarbonFile(segmentDir, FileFactory.getFileType(segmentDir));
-
-    CarbonFile[] files = carbonFile.listFiles(new CarbonFileFilter() {
-      @Override public boolean accept(CarbonFile file) {
-        return file.getName().startsWith(taskId) && file.getName().endsWith(INDEX_FILE_EXT);
-      }
-    });
-    if (files.length > 0) {
-      return files[0].getAbsolutePath();
-    } else {
-      throw new RuntimeException(
-          "Missing Carbon Updated index file for partition[" + partitionId
-              + "] Segment[" + segmentId + "], taskId[" + taskId + "]");
-    }
-  }
-
-  /**
-   * Below method will be used to get the index file present in the segment folder
-   * based on task id
-   *
-   * @param taskId      task id of the file
-   * @param partitionId partition number
-   * @param segmentId   segment number
-   * @return full qualified carbon index path
-   */
-  public String getCarbonDeleteDeltaFilePath(final String taskId, final String partitionId,
-      final String segmentId) {
-    String segmentDir = getSegmentDir(partitionId, segmentId);
-    CarbonFile carbonFile =
-        FileFactory.getCarbonFile(segmentDir, FileFactory.getFileType(segmentDir));
-
-    CarbonFile[] files = carbonFile.listFiles(new CarbonFileFilter() {
-      @Override public boolean accept(CarbonFile file) {
-        return file.getName().startsWith(taskId) && file.getName().endsWith(DELETE_DELTA_FILE_EXT);
-      }
-    });
-    if (files.length > 0) {
-      return files[0].getAbsolutePath();
-    } else {
-      throw new RuntimeException(
-          "Missing Carbon delete delta file index file for partition["
-              + partitionId + "] Segment[" + segmentId + "], taskId[" + taskId
-              + "]");
-    }
-  }
 
   /**
    * Gets absolute path of data file
@@ -427,18 +343,6 @@ public class CarbonTablePath extends Path {
     return segmentDir + File.separator + getCarbonStreamIndexFileName();
   }
 
-  /**
-   * Below method will be used to get the carbon index filename
-   *
-   * @param taskNo               task number
-   * @param factUpdatedTimeStamp time stamp
-   * @return filename
-   */
-  public String getCarbonIndexFileName(int taskNo, String factUpdatedTimeStamp,
-      String indexFileExtension) {
-    return taskNo + "-" + factUpdatedTimeStamp + indexFileExtension;
-  }
-
   public String getSegmentDir(String partitionId, String segmentId) {
     return getPartitionDir(partitionId) + File.separator + SEGMENT_PREFIX + segmentId;
   }
@@ -583,21 +487,6 @@ public class CarbonTablePath extends Path {
         return carbonDataFileName;
       }
     }
-
-    /**
-     * Gets the file name of the delta files.
-     *
-     * @param filePartNo
-     * @param taskNo
-     * @param factUpdateTimeStamp
-     * @param Extension
-     * @return
-     */
-    public static String getCarbonDeltaFileName(String filePartNo, String taskNo,
-        String factUpdateTimeStamp, String Extension) {
-      return DATA_PART_PREFIX + filePartNo + "-" + taskNo + "-" + factUpdateTimeStamp
-          + Extension;
-    }
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryCacheLoaderImplTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryCacheLoaderImplTest.java b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryCacheLoaderImplTest.java
index cea9ad7..7b4a076 100644
--- a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryCacheLoaderImplTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryCacheLoaderImplTest.java
@@ -49,7 +49,7 @@ public class DictionaryCacheLoaderImplTest {
 
   @BeforeClass public static void setUp() {
     CarbonTableIdentifier carbonTableIdentifier = new CarbonTableIdentifier("db", "table1", "1");
-    AbsoluteTableIdentifier absoluteTableIdentifier = new AbsoluteTableIdentifier("/tmp",
+    AbsoluteTableIdentifier absoluteTableIdentifier = AbsoluteTableIdentifier.from("/tmp",
         carbonTableIdentifier);
     Map<String, String> columnProperties = new HashMap<>();
     columnProperties.put("prop1", "value1");

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryColumnUniqueIdentifierTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryColumnUniqueIdentifierTest.java b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryColumnUniqueIdentifierTest.java
index 1fb5a18..d81a60f 100644
--- a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryColumnUniqueIdentifierTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/DictionaryColumnUniqueIdentifierTest.java
@@ -22,7 +22,6 @@ import java.util.Map;
 import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
 import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
 import org.apache.carbondata.core.metadata.ColumnIdentifier;
-import org.apache.carbondata.core.metadata.datatype.DataType;
 import org.apache.carbondata.core.metadata.datatype.DataTypes;
 
 import mockit.Mock;
@@ -45,9 +44,9 @@ public class DictionaryColumnUniqueIdentifierTest {
         new CarbonTableIdentifier("testDatabase", "testTable", "1");
     CarbonTableIdentifier carbonTableIdentifier2 =
         new CarbonTableIdentifier("testDatabase", "testTable", "2");
-    AbsoluteTableIdentifier absoluteTableIdentifier1 = new AbsoluteTableIdentifier("storepath",
+    AbsoluteTableIdentifier absoluteTableIdentifier1 = AbsoluteTableIdentifier.from("storepath",
         carbonTableIdentifier1);
-    AbsoluteTableIdentifier absoluteTableIdentifier2 = new AbsoluteTableIdentifier("storepath",
+    AbsoluteTableIdentifier absoluteTableIdentifier2 = AbsoluteTableIdentifier.from("storepath",
         carbonTableIdentifier2);
     Map<String, String> properties = new HashMap<>();
     ColumnIdentifier columnIdentifier = new ColumnIdentifier("2", properties, DataTypes.STRING);

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryCacheTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryCacheTest.java b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryCacheTest.java
index d6041b0..c0b822b 100644
--- a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryCacheTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ForwardDictionaryCacheTest.java
@@ -28,14 +28,15 @@ import java.util.UUID;
 import org.apache.carbondata.core.cache.Cache;
 import org.apache.carbondata.core.cache.CacheProvider;
 import org.apache.carbondata.core.cache.CacheType;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
 import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
 import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
 import org.apache.carbondata.core.metadata.ColumnIdentifier;
-import org.apache.carbondata.core.constants.CarbonCommonConstants;
 import org.apache.carbondata.core.util.CarbonProperties;
 import org.apache.carbondata.core.util.path.CarbonStorePath;
 import org.apache.carbondata.core.writer.sortindex.CarbonDictionarySortIndexWriter;
 import org.apache.carbondata.core.writer.sortindex.CarbonDictionarySortIndexWriterImpl;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -57,7 +58,7 @@ public class ForwardDictionaryCacheTest extends AbstractDictionaryCacheTest {
     carbonTableIdentifier =
         new CarbonTableIdentifier(databaseName, tableName, UUID.randomUUID().toString());
     absoluteTableIdentifier =
-        new AbsoluteTableIdentifier(carbonStorePath + "/" + databaseName + "/" + tableName,
+        AbsoluteTableIdentifier.from(carbonStorePath + "/" + databaseName + "/" + tableName,
             carbonTableIdentifier);
     columnIdentifiers = new String[] { "name", "place" };
     deleteStorePath();

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCacheTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCacheTest.java b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCacheTest.java
index 9c5b956..37ae9de 100644
--- a/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCacheTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/cache/dictionary/ReverseDictionaryCacheTest.java
@@ -59,9 +59,8 @@ public class ReverseDictionaryCacheTest extends AbstractDictionaryCacheTest {
     this.carbonStorePath = props.getProperty("storePath", "carbonStore");
     carbonTableIdentifier =
         new CarbonTableIdentifier(databaseName, tableName, UUID.randomUUID().toString());
-    absoluteTableIdentifier =
-        new AbsoluteTableIdentifier(carbonStorePath + "/" + databaseName + "/" + tableName,
-            carbonTableIdentifier);
+    absoluteTableIdentifier = AbsoluteTableIdentifier.from(
+        carbonStorePath + "/" + databaseName + "/" + tableName, carbonTableIdentifier);
     columnIdentifiers = new String[] { "name", "place" };
     deleteStorePath();
     prepareDataSet();

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/test/java/org/apache/carbondata/core/carbon/AbsoluteTableIdentifierTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/carbon/AbsoluteTableIdentifierTest.java b/core/src/test/java/org/apache/carbondata/core/carbon/AbsoluteTableIdentifierTest.java
index 6d3ae0e..12d69f5 100644
--- a/core/src/test/java/org/apache/carbondata/core/carbon/AbsoluteTableIdentifierTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/carbon/AbsoluteTableIdentifierTest.java
@@ -33,14 +33,14 @@ public class AbsoluteTableIdentifierTest {
   static AbsoluteTableIdentifier absoluteTableIdentifier4;
 
   @BeforeClass public static void setup() {
-    absoluteTableIdentifier = new AbsoluteTableIdentifier("storePath/databaseName/tableName",
+    absoluteTableIdentifier = AbsoluteTableIdentifier.from("storePath/databaseName/tableName",
         new CarbonTableIdentifier("databaseName", "tableName", "tableId"));
-    absoluteTableIdentifier1 = new AbsoluteTableIdentifier("dummy", null);
-    absoluteTableIdentifier2 = new AbsoluteTableIdentifier("dumgfhmy", null);
+    absoluteTableIdentifier1 = AbsoluteTableIdentifier.from("dummy", null);
+    absoluteTableIdentifier2 = AbsoluteTableIdentifier.from("dumgfhmy", null);
     absoluteTableIdentifier3 =
-        new AbsoluteTableIdentifier("duhgmmy/dumy/dmy/",
+        AbsoluteTableIdentifier.from("duhgmmy/dumy/dmy/",
             new CarbonTableIdentifier("dummy", "dumy", "dmy"));
-    absoluteTableIdentifier4 = new AbsoluteTableIdentifier("storePath/databaseName/tableName",
+    absoluteTableIdentifier4 = AbsoluteTableIdentifier.from("storePath/databaseName/tableName",
         new CarbonTableIdentifier("databaseName", "tableName", "tableId"));
   }
 

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/test/java/org/apache/carbondata/core/datastore/SegmentTaskIndexStoreTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/datastore/SegmentTaskIndexStoreTest.java b/core/src/test/java/org/apache/carbondata/core/datastore/SegmentTaskIndexStoreTest.java
index cec70dd..19e91da 100644
--- a/core/src/test/java/org/apache/carbondata/core/datastore/SegmentTaskIndexStoreTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/datastore/SegmentTaskIndexStoreTest.java
@@ -16,36 +16,27 @@
  */
 package org.apache.carbondata.core.datastore;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.carbondata.core.cache.CacheProvider;
 import org.apache.carbondata.core.cache.CacheType;
-import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
-import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
-import org.apache.carbondata.core.metadata.ColumnarFormatVersion;
 import org.apache.carbondata.core.datastore.block.AbstractIndex;
-import org.apache.carbondata.core.datastore.block.SegmentTaskIndex;
 import org.apache.carbondata.core.datastore.block.SegmentTaskIndexWrapper;
 import org.apache.carbondata.core.datastore.block.TableBlockInfo;
+import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
+import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
+import org.apache.carbondata.core.metadata.ColumnarFormatVersion;
 import org.apache.carbondata.core.metadata.blocklet.BlockletInfo;
 import org.apache.carbondata.core.metadata.blocklet.DataFileFooter;
 import org.apache.carbondata.core.metadata.blocklet.SegmentInfo;
 import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema;
-import org.apache.carbondata.core.util.path.CarbonTablePath;
-import org.apache.carbondata.core.util.CarbonUtil;
 
-import mockit.Mock;
-import mockit.MockUp;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import static junit.framework.TestCase.assertEquals;
-import static junit.framework.TestCase.assertTrue;
 import static org.junit.Assert.assertNull;
 
 public class SegmentTaskIndexStoreTest {
@@ -63,7 +54,7 @@ public class SegmentTaskIndexStoreTest {
             createCache(CacheType.DRIVER_BTREE);
     tableBlockInfo = new TableBlockInfo("file", 0L, "SG100", locations, 10L,
         ColumnarFormatVersion.valueOf(version), null);
-    absoluteTableIdentifier = new AbsoluteTableIdentifier("/tmp",
+    absoluteTableIdentifier = AbsoluteTableIdentifier.from("/tmp",
         new CarbonTableIdentifier("testdatabase", "testtable", "TB100"));
   }
 

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/test/java/org/apache/carbondata/core/reader/CarbonDictionaryReaderImplTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/reader/CarbonDictionaryReaderImplTest.java b/core/src/test/java/org/apache/carbondata/core/reader/CarbonDictionaryReaderImplTest.java
index 4e3bddb..7450382 100644
--- a/core/src/test/java/org/apache/carbondata/core/reader/CarbonDictionaryReaderImplTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/reader/CarbonDictionaryReaderImplTest.java
@@ -25,11 +25,11 @@ import java.util.UUID;
 
 import org.apache.carbondata.core.cache.dictionary.DictionaryColumnUniqueIdentifier;
 import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
-import org.apache.carbondata.core.service.impl.PathFactory;
-import org.apache.carbondata.core.service.CarbonCommonFactory;
 import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
 import org.apache.carbondata.core.metadata.ColumnIdentifier;
+import org.apache.carbondata.core.service.CarbonCommonFactory;
 import org.apache.carbondata.core.service.PathService;
+import org.apache.carbondata.core.service.impl.PathFactory;
 import org.apache.carbondata.core.util.path.CarbonStorePath;
 
 import mockit.Mock;
@@ -49,7 +49,7 @@ public class CarbonDictionaryReaderImplTest {
   @BeforeClass public static void setUp() throws Exception {
     columnIdentifier = new ColumnIdentifier("1", null, null);
     absoluteTableIdentifier =
-        new AbsoluteTableIdentifier("storePath",
+        AbsoluteTableIdentifier.from("tablePath",
             new CarbonTableIdentifier("dbName", "tableName", UUID.randomUUID().toString()));
     DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier =
         new DictionaryColumnUniqueIdentifier(absoluteTableIdentifier, columnIdentifier,

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/test/java/org/apache/carbondata/core/reader/sortindex/CarbonDictionarySortIndexReaderImplTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/reader/sortindex/CarbonDictionarySortIndexReaderImplTest.java b/core/src/test/java/org/apache/carbondata/core/reader/sortindex/CarbonDictionarySortIndexReaderImplTest.java
index 2953c33..b4c791c 100644
--- a/core/src/test/java/org/apache/carbondata/core/reader/sortindex/CarbonDictionarySortIndexReaderImplTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/reader/sortindex/CarbonDictionarySortIndexReaderImplTest.java
@@ -23,17 +23,18 @@ import java.util.List;
 import java.util.UUID;
 
 import org.apache.carbondata.core.cache.dictionary.DictionaryColumnUniqueIdentifier;
+import org.apache.carbondata.core.datastore.filesystem.CarbonFile;
+import org.apache.carbondata.core.datastore.impl.FileFactory;
 import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
 import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
 import org.apache.carbondata.core.metadata.ColumnIdentifier;
-import org.apache.carbondata.core.datastore.filesystem.CarbonFile;
-import org.apache.carbondata.core.datastore.impl.FileFactory;
 import org.apache.carbondata.core.util.CarbonUtil;
 import org.apache.carbondata.core.util.path.CarbonStorePath;
 import org.apache.carbondata.core.writer.CarbonDictionaryWriter;
 import org.apache.carbondata.core.writer.CarbonDictionaryWriterImpl;
 import org.apache.carbondata.core.writer.sortindex.CarbonDictionarySortIndexWriter;
 import org.apache.carbondata.core.writer.sortindex.CarbonDictionarySortIndexWriterImpl;
+
 import org.apache.commons.lang.ArrayUtils;
 import org.junit.After;
 import org.junit.Assert;
@@ -65,7 +66,7 @@ public class CarbonDictionarySortIndexReaderImplTest {
     CarbonTableIdentifier carbonTableIdentifier = new CarbonTableIdentifier("testSchema", "carbon",
     		UUID.randomUUID().toString());
     AbsoluteTableIdentifier absoluteTableIdentifier =
-        new AbsoluteTableIdentifier(storePath+"/testSchema/carbon", carbonTableIdentifier);
+        AbsoluteTableIdentifier.from(storePath+"/testSchema/carbon", carbonTableIdentifier);
     ColumnIdentifier columnIdentifier = new ColumnIdentifier("Name", null, null);
     DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier =
         new DictionaryColumnUniqueIdentifier(absoluteTableIdentifier, columnIdentifier,

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/test/java/org/apache/carbondata/core/scan/filter/FilterUtilTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/scan/filter/FilterUtilTest.java b/core/src/test/java/org/apache/carbondata/core/scan/filter/FilterUtilTest.java
index f1f05f0..89b3122 100644
--- a/core/src/test/java/org/apache/carbondata/core/scan/filter/FilterUtilTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/scan/filter/FilterUtilTest.java
@@ -21,20 +21,17 @@ import java.util.List;
 import java.util.UUID;
 
 import org.apache.carbondata.core.cache.dictionary.AbstractDictionaryCacheTest;
-import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
-import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
 import org.apache.carbondata.core.datastore.IndexKey;
 import org.apache.carbondata.core.datastore.block.SegmentProperties;
-import org.apache.carbondata.core.metadata.datatype.DataType;
+import org.apache.carbondata.core.keygenerator.KeyGenException;
+import org.apache.carbondata.core.keygenerator.mdkey.MultiDimKeyVarLengthGenerator;
+import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
 import org.apache.carbondata.core.metadata.datatype.DataTypes;
-import org.apache.carbondata.core.metadata.datatype.DecimalType;
 import org.apache.carbondata.core.metadata.encoder.Encoding;
 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.ColumnSchema;
-import org.apache.carbondata.core.constants.CarbonCommonConstants;
-import org.apache.carbondata.core.keygenerator.KeyGenException;
-import org.apache.carbondata.core.keygenerator.mdkey.MultiDimKeyVarLengthGenerator;
 import org.apache.carbondata.core.scan.expression.ColumnExpression;
 import org.apache.carbondata.core.scan.expression.Expression;
 import org.apache.carbondata.core.scan.expression.LiteralExpression;
@@ -368,8 +365,6 @@ public class FilterUtilTest extends AbstractDictionaryCacheTest {
 
   @Test public void testGetNoDictionaryValKeyMemberForFilter() throws FilterUnsupportedException {
     boolean isIncludeFilter = true;
-    AbsoluteTableIdentifier absoluteTableIdentifier =
-        new AbsoluteTableIdentifier(this.carbonStorePath, carbonTableIdentifier);
     ColumnExpression expression = new ColumnExpression("test", DataTypes.STRING);
     List<String> evaluateResultListFinal = new ArrayList<>();
     evaluateResultListFinal.add("test1");

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/test/java/org/apache/carbondata/core/util/path/CarbonFormatDirectoryStructureTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/util/path/CarbonFormatDirectoryStructureTest.java b/core/src/test/java/org/apache/carbondata/core/util/path/CarbonFormatDirectoryStructureTest.java
index 5f7e971..936f87f 100644
--- a/core/src/test/java/org/apache/carbondata/core/util/path/CarbonFormatDirectoryStructureTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/util/path/CarbonFormatDirectoryStructureTest.java
@@ -41,7 +41,7 @@ public class CarbonFormatDirectoryStructureTest {
     CarbonTableIdentifier tableIdentifier = new CarbonTableIdentifier("d1", "t1", UUID.randomUUID().toString());
     CarbonStorePath carbonStorePath = new CarbonStorePath(CARBON_STORE);
     AbsoluteTableIdentifier absoluteTableIdentifier =
-        new AbsoluteTableIdentifier(CARBON_STORE + "/d1/t1", tableIdentifier);
+        AbsoluteTableIdentifier.from(CARBON_STORE + "/d1/t1", tableIdentifier);
     CarbonTablePath carbonTablePath = CarbonStorePath.getCarbonTablePath(absoluteTableIdentifier);
     assertTrue(carbonTablePath.getPath().replace("\\", "/").equals(CARBON_STORE + "/d1/t1"));
     assertTrue(carbonTablePath.getSchemaFilePath().replace("\\", "/").equals(CARBON_STORE + "/d1/t1/Metadata/schema"));

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/test/java/org/apache/carbondata/core/writer/CarbonDictionaryWriterImplTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/writer/CarbonDictionaryWriterImplTest.java b/core/src/test/java/org/apache/carbondata/core/writer/CarbonDictionaryWriterImplTest.java
index 86ba9c8..4fca00e 100644
--- a/core/src/test/java/org/apache/carbondata/core/writer/CarbonDictionaryWriterImplTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/writer/CarbonDictionaryWriterImplTest.java
@@ -33,23 +33,23 @@ import java.util.Properties;
 import java.util.UUID;
 
 import org.apache.carbondata.core.cache.dictionary.DictionaryColumnUniqueIdentifier;
-import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
-import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
-import org.apache.carbondata.core.metadata.ColumnIdentifier;
-import org.apache.carbondata.core.util.path.CarbonStorePath;
-import org.apache.carbondata.core.util.path.CarbonTablePath;
 import org.apache.carbondata.core.constants.CarbonCommonConstants;
 import org.apache.carbondata.core.datastore.filesystem.CarbonFile;
 import org.apache.carbondata.core.datastore.impl.FileFactory;
+import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
+import org.apache.carbondata.core.metadata.CarbonTableIdentifier;
+import org.apache.carbondata.core.metadata.ColumnIdentifier;
 import org.apache.carbondata.core.reader.CarbonDictionaryColumnMetaChunk;
 import org.apache.carbondata.core.reader.CarbonDictionaryMetadataReaderImpl;
 import org.apache.carbondata.core.reader.CarbonDictionaryReaderImpl;
 import org.apache.carbondata.core.util.CarbonProperties;
 import org.apache.carbondata.core.util.CarbonUtil;
+import org.apache.carbondata.core.util.path.CarbonStorePath;
+import org.apache.carbondata.core.util.path.CarbonTablePath;
+import org.apache.carbondata.format.ColumnDictionaryChunkMeta;
 
 import mockit.Mock;
 import mockit.MockUp;
-import org.apache.carbondata.format.ColumnDictionaryChunkMeta;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -103,7 +103,7 @@ public class CarbonDictionaryWriterImplTest {
     this.carbonStorePath = props.getProperty("storePath", "carbonStore");
     this.columnIdentifier = new ColumnIdentifier("Name", null, null);
     carbonTableIdentifier = new CarbonTableIdentifier(databaseName, tableName, UUID.randomUUID().toString());
-    absoluteTableIdentifier = new AbsoluteTableIdentifier(carbonStorePath, carbonTableIdentifier);
+    absoluteTableIdentifier = AbsoluteTableIdentifier.from(carbonStorePath, carbonTableIdentifier);
     this.dictionaryColumnUniqueIdentifier =
         new DictionaryColumnUniqueIdentifier(absoluteTableIdentifier, columnIdentifier,
             columnIdentifier.getDataType(),

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/core/src/test/java/org/apache/carbondata/core/writer/sortindex/CarbonDictionarySortIndexWriterImplTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/carbondata/core/writer/sortindex/CarbonDictionarySortIndexWriterImplTest.java b/core/src/test/java/org/apache/carbondata/core/writer/sortindex/CarbonDictionarySortIndexWriterImplTest.java
index e64726a..2b5cc85 100644
--- a/core/src/test/java/org/apache/carbondata/core/writer/sortindex/CarbonDictionarySortIndexWriterImplTest.java
+++ b/core/src/test/java/org/apache/carbondata/core/writer/sortindex/CarbonDictionarySortIndexWriterImplTest.java
@@ -59,7 +59,7 @@ public class CarbonDictionarySortIndexWriterImplTest {
     String tablePath =
         storePath + "/" + carbonTableIdentifier.getDatabaseName() + "/" + carbonTableIdentifier
             .getTableName();
-    absoluteTableIdentifier = new AbsoluteTableIdentifier(tablePath, carbonTableIdentifier);
+    absoluteTableIdentifier = AbsoluteTableIdentifier.from(tablePath, carbonTableIdentifier);
     columnIdentifier = new ColumnIdentifier("Name", null, null);
     DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier =
         new DictionaryColumnUniqueIdentifier(absoluteTableIdentifier, columnIdentifier,

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/hadoop/src/main/java/org/apache/carbondata/hadoop/util/SchemaReader.java
----------------------------------------------------------------------
diff --git a/hadoop/src/main/java/org/apache/carbondata/hadoop/util/SchemaReader.java b/hadoop/src/main/java/org/apache/carbondata/hadoop/util/SchemaReader.java
index 2e6abad..47afc9c 100644
--- a/hadoop/src/main/java/org/apache/carbondata/hadoop/util/SchemaReader.java
+++ b/hadoop/src/main/java/org/apache/carbondata/hadoop/util/SchemaReader.java
@@ -59,11 +59,11 @@ public class SchemaReader {
       thriftReader.close();
 
       SchemaConverter schemaConverter = new ThriftWrapperSchemaConverterImpl();
-      TableInfo wrapperTableInfo = schemaConverter
-          .fromExternalToWrapperTableInfo(tableInfo,
-              identifier.getCarbonTableIdentifier().getDatabaseName(), tableName,
-              identifier.getTablePath());
-      wrapperTableInfo.setMetaDataFilepath(CarbonTablePath.getFolderContainingFile(schemaFilePath));
+      TableInfo wrapperTableInfo = schemaConverter.fromExternalToWrapperTableInfo(
+          tableInfo,
+          identifier.getCarbonTableIdentifier().getDatabaseName(),
+          tableName,
+          identifier.getTablePath());
       CarbonMetadata.getInstance().loadTableMetadata(wrapperTableInfo);
       return CarbonMetadata.getInstance().getCarbonTable(
           identifier.getCarbonTableIdentifier().getTableUniqueName());

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/hadoop/src/test/java/org/apache/carbondata/hadoop/streaming/CarbonStreamInputFormatTest.java
----------------------------------------------------------------------
diff --git a/hadoop/src/test/java/org/apache/carbondata/hadoop/streaming/CarbonStreamInputFormatTest.java b/hadoop/src/test/java/org/apache/carbondata/hadoop/streaming/CarbonStreamInputFormatTest.java
index 097ff3e..d7f9ac2 100644
--- a/hadoop/src/test/java/org/apache/carbondata/hadoop/streaming/CarbonStreamInputFormatTest.java
+++ b/hadoop/src/test/java/org/apache/carbondata/hadoop/streaming/CarbonStreamInputFormatTest.java
@@ -51,14 +51,15 @@ public class CarbonStreamInputFormatTest extends TestCase {
   private TaskAttemptContext taskAttemptContext;
   private Configuration hadoopConf;
   private AbsoluteTableIdentifier identifier;
-  private String storePath;
+  private String tablePath;
 
 
   @Override protected void setUp() throws Exception {
-    storePath = new File("target/stream_input").getCanonicalPath();
+    tablePath = new File("target/stream_input").getCanonicalPath();
     String dbName = "default";
     String tableName = "stream_table_input";
-    identifier = new AbsoluteTableIdentifier(storePath,
+    identifier = AbsoluteTableIdentifier.from(
+        tablePath,
         new CarbonTableIdentifier(dbName, tableName, UUID.randomUUID().toString()));
 
     JobID jobId = CarbonInputFormatUtil.getJobId(new Date(), 0);
@@ -91,8 +92,8 @@ public class CarbonStreamInputFormatTest extends TestCase {
 
   @Override protected void tearDown() throws Exception {
     super.tearDown();
-    if (storePath != null) {
-      FileFactory.deleteAllFilesOfDir(new File(storePath));
+    if (tablePath != null) {
+      FileFactory.deleteAllFilesOfDir(new File(tablePath));
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/hadoop/src/test/java/org/apache/carbondata/hadoop/streaming/CarbonStreamOutputFormatTest.java
----------------------------------------------------------------------
diff --git a/hadoop/src/test/java/org/apache/carbondata/hadoop/streaming/CarbonStreamOutputFormatTest.java b/hadoop/src/test/java/org/apache/carbondata/hadoop/streaming/CarbonStreamOutputFormatTest.java
index 53fc071..e871c7e 100644
--- a/hadoop/src/test/java/org/apache/carbondata/hadoop/streaming/CarbonStreamOutputFormatTest.java
+++ b/hadoop/src/test/java/org/apache/carbondata/hadoop/streaming/CarbonStreamOutputFormatTest.java
@@ -47,7 +47,7 @@ public class CarbonStreamOutputFormatTest extends TestCase {
   private Configuration hadoopConf;
   private TaskAttemptID taskAttemptId;
   private CarbonLoadModel carbonLoadModel;
-  private String storePath;
+  private String tablePath;
 
   @Override protected void setUp() throws Exception {
     super.setUp();
@@ -62,11 +62,13 @@ public class CarbonStreamOutputFormatTest extends TestCase {
     hadoopConf.setBoolean("mapred.task.is.map", true);
     hadoopConf.setInt("mapred.task.partition", 0);
 
-    storePath = new File("target/stream_output").getCanonicalPath();
+    tablePath = new File("target/stream_output").getCanonicalPath();
     String dbName = "default";
     String tableName = "stream_table_output";
-    AbsoluteTableIdentifier identifier = new AbsoluteTableIdentifier(storePath,
-        new CarbonTableIdentifier(dbName, tableName, UUID.randomUUID().toString()));
+    AbsoluteTableIdentifier identifier =
+        AbsoluteTableIdentifier.from(
+            tablePath,
+            new CarbonTableIdentifier(dbName, tableName, UUID.randomUUID().toString()));
 
     CarbonTable table = StoreCreator.createTable(identifier);
 
@@ -112,8 +114,8 @@ public class CarbonStreamOutputFormatTest extends TestCase {
 
   @Override protected void tearDown() throws Exception {
     super.tearDown();
-    if (storePath != null) {
-      FileFactory.deleteAllFilesOfDir(new File(storePath));
+    if (tablePath != null) {
+      FileFactory.deleteAllFilesOfDir(new File(tablePath));
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/hadoop/src/test/java/org/apache/carbondata/hadoop/test/util/StoreCreator.java
----------------------------------------------------------------------
diff --git a/hadoop/src/test/java/org/apache/carbondata/hadoop/test/util/StoreCreator.java b/hadoop/src/test/java/org/apache/carbondata/hadoop/test/util/StoreCreator.java
index ab8790d..bea1d5e 100644
--- a/hadoop/src/test/java/org/apache/carbondata/hadoop/test/util/StoreCreator.java
+++ b/hadoop/src/test/java/org/apache/carbondata/hadoop/test/util/StoreCreator.java
@@ -107,7 +107,9 @@ public class StoreCreator {
       String dbName = "testdb";
       String tableName = "testtable";
       absoluteTableIdentifier =
-          new AbsoluteTableIdentifier(storePath +"/testdb/testtable", new CarbonTableIdentifier(dbName, tableName, UUID.randomUUID().toString()));
+          AbsoluteTableIdentifier.from(
+              storePath +"/testdb/testtable",
+              new CarbonTableIdentifier(dbName, tableName, UUID.randomUUID().toString()));
     } catch (IOException ex) {
 
     }
@@ -276,16 +278,16 @@ public class StoreCreator {
     );
     tableInfo.setLastUpdatedTime(System.currentTimeMillis());
     tableInfo.setFactTable(tableSchema);
-    CarbonTablePath carbonTablePath = CarbonStorePath
-        .getCarbonTablePath(absoluteTableIdentifier);
+    CarbonTablePath carbonTablePath = CarbonStorePath.getCarbonTablePath(absoluteTableIdentifier);
     String schemaFilePath = carbonTablePath.getSchemaFilePath();
     String schemaMetadataPath = CarbonTablePath.getFolderContainingFile(schemaFilePath);
-    tableInfo.setMetaDataFilepath(schemaMetadataPath);
     CarbonMetadata.getInstance().loadTableMetadata(tableInfo);
 
     SchemaConverter schemaConverter = new ThriftWrapperSchemaConverterImpl();
-    org.apache.carbondata.format.TableInfo thriftTableInfo = schemaConverter
-        .fromWrapperToExternalTableInfo(tableInfo, tableInfo.getDatabaseName(),
+    org.apache.carbondata.format.TableInfo thriftTableInfo =
+        schemaConverter.fromWrapperToExternalTableInfo(
+            tableInfo,
+            tableInfo.getDatabaseName(),
             tableInfo.getFactTable().getTableName());
     org.apache.carbondata.format.SchemaEvolutionEntry schemaEvolutionEntry =
         new org.apache.carbondata.format.SchemaEvolutionEntry(tableInfo.getLastUpdatedTime());

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/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 ce159d6..7fe55fb 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
@@ -307,7 +307,7 @@ public class CarbonTableReader {
       // get the store path of the table.
 
       AbsoluteTableIdentifier absoluteTableIdentifier =
-          new AbsoluteTableIdentifier(tablePath, cache.carbonTableIdentifier);
+          AbsoluteTableIdentifier.from(tablePath, cache.carbonTableIdentifier);
       cache.carbonTablePath =
           PathFactory.getInstance().getCarbonTablePath(absoluteTableIdentifier, null);
       // cache the table
@@ -336,8 +336,6 @@ public class CarbonTableReader {
       TableInfo wrapperTableInfo = schemaConverter
           .fromExternalToWrapperTableInfo(tableInfo, table.getSchemaName(), table.getTableName(),
               tablePath);
-      wrapperTableInfo.setMetaDataFilepath(
-              CarbonTablePath.getFolderContainingFile(cache.carbonTablePath.getSchemaFilePath()));
 
       // Step 4: Load metadata info into CarbonMetadata
       CarbonMetadata.getInstance().loadTableMetadata(wrapperTableInfo);

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/integration/presto/src/test/scala/org/apache/carbondata/presto/util/CarbonDataStoreCreator.scala
----------------------------------------------------------------------
diff --git a/integration/presto/src/test/scala/org/apache/carbondata/presto/util/CarbonDataStoreCreator.scala b/integration/presto/src/test/scala/org/apache/carbondata/presto/util/CarbonDataStoreCreator.scala
index 87f5fa0..eda19c4 100644
--- a/integration/presto/src/test/scala/org/apache/carbondata/presto/util/CarbonDataStoreCreator.scala
+++ b/integration/presto/src/test/scala/org/apache/carbondata/presto/util/CarbonDataStoreCreator.scala
@@ -70,7 +70,7 @@ object CarbonDataStoreCreator {
       logger.info("Creating The Carbon Store")
       val dbName: String = "testdb"
       val tableName: String = "testtable"
-      val absoluteTableIdentifier = new AbsoluteTableIdentifier(
+      val absoluteTableIdentifier = AbsoluteTableIdentifier.from(
         storePath + "/"+ dbName + "/" + tableName,
         new CarbonTableIdentifier(dbName,
           tableName,
@@ -297,7 +297,6 @@ object CarbonDataStoreCreator {
     val schemaFilePath: String = carbonTablePath.getSchemaFilePath
     val schemaMetadataPath: String =
       CarbonTablePath.getFolderContainingFile(schemaFilePath)
-    tableInfo.setMetaDataFilepath(schemaMetadataPath)
     CarbonMetadata.getInstance.loadTableMetadata(tableInfo)
     val schemaConverter: SchemaConverter =
       new ThriftWrapperSchemaConverterImpl()

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/datacompaction/DataCompactionCardinalityBoundryTest.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/datacompaction/DataCompactionCardinalityBoundryTest.scala b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/datacompaction/DataCompactionCardinalityBoundryTest.scala
index e53df6c..ea95945 100644
--- a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/datacompaction/DataCompactionCardinalityBoundryTest.scala
+++ b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/datacompaction/DataCompactionCardinalityBoundryTest.scala
@@ -20,6 +20,7 @@ import scala.collection.JavaConverters._
 
 import org.apache.spark.sql.Row
 import org.scalatest.BeforeAndAfterAll
+
 import org.apache.carbondata.core.metadata.{AbsoluteTableIdentifier, CarbonTableIdentifier}
 import org.apache.carbondata.core.constants.CarbonCommonConstants
 import org.apache.carbondata.core.statusmanager.SegmentStatusManager
@@ -73,8 +74,8 @@ class DataCompactionCardinalityBoundryTest extends QueryTest with BeforeAndAfter
     var noOfRetries = 0
     while (status && noOfRetries < 10) {
 
-      val segmentStatusManager: SegmentStatusManager = new SegmentStatusManager(new
-          AbsoluteTableIdentifier(
+      val segmentStatusManager: SegmentStatusManager = new SegmentStatusManager(
+          AbsoluteTableIdentifier.from(
             CarbonProperties.getInstance.getProperty(CarbonCommonConstants.STORE_LOCATION),
             new CarbonTableIdentifier("default", "cardinalityTest", "1")
           )

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/datacompaction/DataCompactionLockTest.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/datacompaction/DataCompactionLockTest.scala b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/datacompaction/DataCompactionLockTest.scala
index 508ca6c..20a779d 100644
--- a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/datacompaction/DataCompactionLockTest.scala
+++ b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/datacompaction/DataCompactionLockTest.scala
@@ -21,6 +21,7 @@ package org.apache.carbondata.spark.testsuite.datacompaction
 import scala.collection.JavaConverters._
 
 import org.scalatest.BeforeAndAfterAll
+
 import org.apache.carbondata.core.util.path.{CarbonStorePath, CarbonTablePath}
 import org.apache.carbondata.core.metadata.{AbsoluteTableIdentifier, CarbonTableIdentifier}
 import org.apache.carbondata.core.constants.CarbonCommonConstants
@@ -35,8 +36,8 @@ import org.apache.spark.sql.test.util.QueryTest
   */
 class DataCompactionLockTest extends QueryTest with BeforeAndAfterAll {
 
-  val absoluteTableIdentifier: AbsoluteTableIdentifier = new
-      AbsoluteTableIdentifier(
+  val absoluteTableIdentifier: AbsoluteTableIdentifier =
+      AbsoluteTableIdentifier.from(
         CarbonProperties.getInstance.getProperty(CarbonCommonConstants.STORE_LOCATION),
         new CarbonTableIdentifier(
           CarbonCommonConstants.DATABASE_DEFAULT_NAME, "compactionlocktesttable", "1")

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestLoadDataFrame.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestLoadDataFrame.scala b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestLoadDataFrame.scala
index 3399740..57c5204 100644
--- a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestLoadDataFrame.scala
+++ b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestLoadDataFrame.scala
@@ -17,11 +17,12 @@
 
 package org.apache.carbondata.spark.testsuite.dataload
 
+import java.io.File
 import java.math.BigDecimal
 
 import org.apache.spark.sql.test.util.QueryTest
 import org.apache.spark.sql.types._
-import org.apache.spark.sql.{DataFrame, Row, SaveMode}
+import org.apache.spark.sql.{AnalysisException, DataFrame, Row, SaveMode}
 import org.scalatest.BeforeAndAfterAll
 
 class TestLoadDataFrame extends QueryTest with BeforeAndAfterAll {
@@ -222,6 +223,26 @@ test("test the boolean data type"){
     )
   }
 
+  test("test datasource table with specified table path") {
+    val path = "./source"
+    df2.write
+      .format("carbondata")
+      .option("tableName", "carbon10")
+      .option("tablePath", path)
+      .mode(SaveMode.Overwrite)
+      .save()
+    assert(new File(path).exists())
+    checkAnswer(
+      sql("select count(*) from carbon10 where c3 > 500"), Row(500)
+    )
+    sql("drop table carbon10")
+    assert(! new File(path).exists())
+    assert(intercept[AnalysisException](
+      sql("select count(*) from carbon10 where c3 > 500"))
+      .message
+      .contains("not found"))
+  }
+
   override def afterAll {
     dropTable
   }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestLoadDataWithHiveSyntaxDefaultFormat.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestLoadDataWithHiveSyntaxDefaultFormat.scala b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestLoadDataWithHiveSyntaxDefaultFormat.scala
index c29e517..1d5b33b 100644
--- a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestLoadDataWithHiveSyntaxDefaultFormat.scala
+++ b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestLoadDataWithHiveSyntaxDefaultFormat.scala
@@ -19,8 +19,9 @@ package org.apache.carbondata.spark.testsuite.dataload
 
 import java.io.File
 
-import org.apache.spark.sql.Row
+import org.apache.spark.sql.{AnalysisException, Row}
 import org.scalatest.BeforeAndAfterAll
+
 import org.apache.carbondata.core.constants.CarbonCommonConstants
 import org.apache.carbondata.core.util.CarbonProperties
 import org.apache.spark.sql.test.util.QueryTest
@@ -687,6 +688,47 @@ class TestLoadDataWithHiveSyntaxDefaultFormat extends QueryTest with BeforeAndAf
     checkAnswer(sql("select salary from double_test limit 1"),Row(7.756787654567891E23))
   }
 
+  test("test table with specified table path") {
+    val path = "./source"
+    sql("drop table if exists table_path_test")
+    sql(
+      "CREATE table table_path_test (empno string, salary double) STORED BY 'carbondata' " +
+      s"LOCATION '$path'"
+    )
+    sql(
+      s"load data local inpath '$resourcesPath/double.csv' into table table_path_test options" +
+      "('FILEHEADER'='empno,salary')")
+    assert(new File(path).exists())
+    checkAnswer(sql("select salary from table_path_test limit 1"),Row(7.756787654567891E23))
+    sql("drop table table_path_test")
+    assert(! new File(path).exists())
+    assert(intercept[AnalysisException](
+      sql("select salary from table_path_test limit 1"))
+      .message
+      .contains("not found"))
+  }
+
+  test("test table with specified database and table path") {
+    val path = "./source"
+    sql("drop database if exists test cascade")
+    sql("create database if not exists test")
+    sql("CREATE table test.table_path_test (empno string, salary double) " +
+        "STORED BY 'carbondata'" +
+        s"LOCATION '$path'")
+    sql(
+      s"load data local inpath '$resourcesPath/double.csv' into table test.table_path_test options" +
+      "('FILEHEADER'='empno,salary')")
+    assert(new File(path).exists())
+    checkAnswer(sql("select salary from test.table_path_test limit 1"),Row(7.756787654567891E23))
+    sql("drop table test.table_path_test")
+    assert(! new File(path).exists())
+    assert(intercept[AnalysisException](
+      sql("select salary from test.table_path_test limit 1"))
+      .message
+      .contains("not found"))
+    sql("drop database if exists test cascade")
+  }
+
   override def afterAll {
     sql("drop table if exists escapechar1")
     sql("drop table if exists escapechar2")

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/DeleteCarbonTableTestCase.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/DeleteCarbonTableTestCase.scala b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/DeleteCarbonTableTestCase.scala
index f7e93af..efbe807 100644
--- a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/DeleteCarbonTableTestCase.scala
+++ b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/DeleteCarbonTableTestCase.scala
@@ -105,7 +105,7 @@ class DeleteCarbonTableTestCase extends QueryTest with BeforeAndAfterAll {
   }
 
   test("Records more than one pagesize after delete operation ") {
-    sql("DROP TABLE IF EXISTS default.carbon2")
+    sql("DROP TABLE IF EXISTS carbon2")
     import sqlContext.implicits._
     val df = sqlContext.sparkContext.parallelize(1 to 2000000)
       .map(x => (x+"a", "b", x))
@@ -118,15 +118,15 @@ class DeleteCarbonTableTestCase extends QueryTest with BeforeAndAfterAll {
       .mode(SaveMode.Overwrite)
       .save()
 
-    checkAnswer(sql("select count(*) from default.carbon2"), Seq(Row(2000000)))
+    checkAnswer(sql("select count(*) from carbon2"), Seq(Row(2000000)))
 
-    sql("delete from default.carbon2 where c1 = '99999a'").show()
+    sql("delete from carbon2 where c1 = '99999a'").show()
 
-    checkAnswer(sql("select count(*) from default.carbon2"), Seq(Row(1999999)))
+    checkAnswer(sql("select count(*) from carbon2"), Seq(Row(1999999)))
 
-    checkAnswer(sql("select * from default.carbon2 where c1 = '99999a'"), Seq())
+    checkAnswer(sql("select * from carbon2 where c1 = '99999a'"), Seq())
 
-    sql("DROP TABLE IF EXISTS default.carbon2")
+    sql("DROP TABLE IF EXISTS carbon2")
   }
 
   test("test if delete is unsupported for pre-aggregate tables") {

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/UpdateCarbonTableTestCase.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/UpdateCarbonTableTestCase.scala b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/UpdateCarbonTableTestCase.scala
index 005dc01..d381a43 100644
--- a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/UpdateCarbonTableTestCase.scala
+++ b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/iud/UpdateCarbonTableTestCase.scala
@@ -424,7 +424,7 @@ class UpdateCarbonTableTestCase extends QueryTest with BeforeAndAfterAll {
   }
 
   test("More records after update operation ") {
-    sql("DROP TABLE IF EXISTS default.carbon1")
+    sql("DROP TABLE IF EXISTS carbon1")
     import sqlContext.implicits._
     val df = sqlContext.sparkContext.parallelize(1 to 36000)
       .map(x => (x+"a", "b", x))
@@ -437,15 +437,15 @@ class UpdateCarbonTableTestCase extends QueryTest with BeforeAndAfterAll {
       .mode(SaveMode.Overwrite)
       .save()
 
-    checkAnswer(sql("select count(*) from default.carbon1"), Seq(Row(36000)))
+    checkAnswer(sql("select count(*) from carbon1"), Seq(Row(36000)))
 
-    sql("update default.carbon1 set (c1)=('test123') where c1='9999a'").show()
+    sql("update carbon1 set (c1)=('test123') where c1='9999a'").show()
 
-    checkAnswer(sql("select count(*) from default.carbon1"), Seq(Row(36000)))
+    checkAnswer(sql("select count(*) from carbon1"), Seq(Row(36000)))
 
-    checkAnswer(sql("select * from default.carbon1 where c1 = 'test123'"), Row("test123","b",9999))
+    checkAnswer(sql("select * from carbon1 where c1 = 'test123'"), Row("test123","b",9999))
 
-    sql("DROP TABLE IF EXISTS default.carbon1")
+    sql("DROP TABLE IF EXISTS carbon1")
   }
 
   test("""CARBONDATA-1445 carbon.update.persist.enable=false it will fail to update data""") {
@@ -455,8 +455,8 @@ class UpdateCarbonTableTestCase extends QueryTest with BeforeAndAfterAll {
     val df = sqlContext.sparkContext.parallelize(0 to 50)
       .map(x => ("a", x.toString, (x % 2).toString, x, x.toLong, x * 2))
       .toDF("stringField1", "stringField2", "stringField3", "intField", "longField", "int2Field")
-    sql("DROP TABLE IF EXISTS default.study_carbondata ")
-    sql(s""" CREATE TABLE IF NOT EXISTS default.study_carbondata (
+    sql("DROP TABLE IF EXISTS study_carbondata ")
+    sql(s""" CREATE TABLE IF NOT EXISTS study_carbondata (
            |    stringField1          string,
            |    stringField2          string,
            |    stringField3          string,
@@ -473,14 +473,14 @@ class UpdateCarbonTableTestCase extends QueryTest with BeforeAndAfterAll {
       .mode(SaveMode.Append)
       .save()
     sql("""
-      UPDATE default.study_carbondata a
+      UPDATE study_carbondata a
           SET (a.stringField1, a.stringField2) = (concat(a.stringField1 , "_test" ), concat(a.stringField2 , "_test" ))
       WHERE a.stringField2 = '1'
       """).show()
-    assert(sql("select stringField1 from default.study_carbondata where stringField2 = '1_test'").collect().length == 1)
+    assert(sql("select stringField1 from study_carbondata where stringField2 = '1_test'").collect().length == 1)
     CarbonProperties.getInstance()
       .addProperty(CarbonCommonConstants.isPersistEnabled, "true")
-    sql("DROP TABLE IF EXISTS default.study_carbondata ")
+    sql("DROP TABLE IF EXISTS study_carbondata ")
   }
 
   test("update table in carbondata with rand() ") {

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/integration/spark-common/src/main/scala/org/apache/carbondata/api/CarbonStore.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common/src/main/scala/org/apache/carbondata/api/CarbonStore.scala b/integration/spark-common/src/main/scala/org/apache/carbondata/api/CarbonStore.scala
index 4a0d834..f4f569b 100644
--- a/integration/spark-common/src/main/scala/org/apache/carbondata/api/CarbonStore.scala
+++ b/integration/spark-common/src/main/scala/org/apache/carbondata/api/CarbonStore.scala
@@ -43,8 +43,6 @@ object CarbonStore {
   private val LOGGER = LogServiceFactory.getLogService(this.getClass.getCanonicalName)
 
   def showSegments(
-      dbName: String,
-      tableName: String,
       limit: Option[String],
       tableFolderPath: String): Seq[Row] = {
     val loadMetadataDetailsArray = SegmentStatusManager.readLoadMetadata(tableFolderPath)
@@ -149,6 +147,7 @@ object CarbonStore {
     }
   }
 
+  // TODO: move dbName and tableName to caller, caller should handle the log and error
   def deleteLoadById(
       loadids: Seq[String],
       dbName: String,
@@ -175,6 +174,7 @@ object CarbonStore {
     Seq.empty
   }
 
+  // TODO: move dbName and tableName to caller, caller should handle the log and error
   def deleteLoadByDate(
       timestamp: String,
       dbName: String,

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2fe7758b/integration/spark-common/src/main/scala/org/apache/carbondata/events/CreateTableEvents.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common/src/main/scala/org/apache/carbondata/events/CreateTableEvents.scala b/integration/spark-common/src/main/scala/org/apache/carbondata/events/CreateTableEvents.scala
index 3b03e4d..44db43a 100644
--- a/integration/spark-common/src/main/scala/org/apache/carbondata/events/CreateTableEvents.scala
+++ b/integration/spark-common/src/main/scala/org/apache/carbondata/events/CreateTableEvents.scala
@@ -19,25 +19,25 @@ package org.apache.carbondata.events
 
 import org.apache.spark.sql._
 
-import org.apache.carbondata.core.metadata.CarbonTableIdentifier
+import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier
 
 /**
  * Class for handling operations before start of a load process.
  * Example usage: For validation purpose
  */
-case class CreateTablePreExecutionEvent(sparkSession: SparkSession,
-    carbonTableIdentifier: CarbonTableIdentifier,
-    storePath: String) extends Event with TableEventInfo
+case class CreateTablePreExecutionEvent(
+    sparkSession: SparkSession,
+    identifier: AbsoluteTableIdentifier) extends Event with TableEventInfo
 
 /**
  * Class for handling operations after data load completion and before final
  * commit of load operation. Example usage: For loading pre-aggregate tables
  */
 case class CreateTablePostExecutionEvent(sparkSession: SparkSession,
-    carbonTableIdentifier: CarbonTableIdentifier) extends Event with TableEventInfo
+    identifier: AbsoluteTableIdentifier) extends Event with TableEventInfo
 
 /**
  * Class for handling clean up in case of any failure and abort the operation.
  */
 case class CreateTableAbortExecutionEvent(sparkSession: SparkSession,
-    carbonTableIdentifier: CarbonTableIdentifier) extends Event with TableEventInfo
+    identifier: AbsoluteTableIdentifier) extends Event with TableEventInfo


Mime
View raw message