carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenliang...@apache.org
Subject [32/52] [partial] incubator-carbondata git commit: move core package
Date Mon, 16 Jan 2017 14:53:09 GMT
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/compressor/ChunkCompressorMeta.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/compressor/ChunkCompressorMeta.java b/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/compressor/ChunkCompressorMeta.java
new file mode 100644
index 0000000..18a8766
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/compressor/ChunkCompressorMeta.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.metadata.blocklet.compressor;
+
+import java.io.Serializable;
+
+/**
+ * Represents the compression information of data of one dimension
+ * one dimension group in one blocklet
+ */
+public class ChunkCompressorMeta implements Serializable {
+
+  /**
+   * serialization version
+   */
+  private static final long serialVersionUID = -6697087170420991140L;
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/datachunk/DataChunk.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/datachunk/DataChunk.java b/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/datachunk/DataChunk.java
new file mode 100644
index 0000000..83ce273
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/datachunk/DataChunk.java
@@ -0,0 +1,228 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.carbondata.core.metadata.blocklet.datachunk;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.apache.carbondata.core.metadata.ValueEncoderMeta;
+import org.apache.carbondata.core.metadata.encoder.Encoding;
+
+/**
+ * Class holds the information about the data chunk metadata
+ */
+public class DataChunk implements Serializable {
+
+  /**
+   * serialization version
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * whether this chunk is a row chunk or column chunk
+   */
+  private boolean isRowMajor;
+
+  /**
+   * Offset of data page
+   */
+  private long dataPageOffset;
+
+  /**
+   * length of data page
+   */
+  private int dataPageLength;
+
+  /**
+   * information about presence of values in each row of this column chunk
+   */
+  private transient PresenceMeta nullValueIndexForColumn;
+
+  /**
+   * offset of row id page, only if encoded using inverted index
+   */
+  private long rowIdPageOffset;
+
+  /**
+   * length of row id page, only if encoded using inverted index
+   */
+  private int rowIdPageLength;
+
+  /**
+   * offset of rle page, only if RLE coded.
+   */
+  private long rlePageOffset;
+
+  /**
+   * length of rle page, only if RLE coded.
+   */
+  private int rlePageLength;
+
+  /**
+   * The List of encoders overriden at node level
+   */
+  private List<Encoding> encodingList;
+
+  /**
+   * value encoder meta which will holds the information
+   * about max, min, decimal length, type
+   */
+  private List<ValueEncoderMeta> valueEncoderMetaList;
+
+  /**
+   * @return the isRowMajor
+   */
+  public boolean isRowMajor() {
+    return isRowMajor;
+  }
+
+  /**
+   * @param isRowMajor the isRowMajor to set
+   */
+  public void setRowMajor(boolean isRowMajor) {
+    this.isRowMajor = isRowMajor;
+  }
+
+  /**
+   * @return the dataPageOffset
+   */
+  public long getDataPageOffset() {
+    return dataPageOffset;
+  }
+
+  /**
+   * @param dataPageOffset the dataPageOffset to set
+   */
+  public void setDataPageOffset(long dataPageOffset) {
+    this.dataPageOffset = dataPageOffset;
+  }
+
+  /**
+   * @return the dataPageLength
+   */
+  public int getDataPageLength() {
+    return dataPageLength;
+  }
+
+  /**
+   * @param dataPageLength the dataPageLength to set
+   */
+  public void setDataPageLength(int dataPageLength) {
+    this.dataPageLength = dataPageLength;
+  }
+
+  /**
+   * @return the nullValueIndexForColumn
+   */
+  public PresenceMeta getNullValueIndexForColumn() {
+    return nullValueIndexForColumn;
+  }
+
+  /**
+   * @param nullValueIndexForColumn the nullValueIndexForColumn to set
+   */
+  public void setNullValueIndexForColumn(PresenceMeta nullValueIndexForColumn) {
+    this.nullValueIndexForColumn = nullValueIndexForColumn;
+  }
+
+  /**
+   * @return the rowIdPageOffset
+   */
+  public long getRowIdPageOffset() {
+    return rowIdPageOffset;
+  }
+
+  /**
+   * @param rowIdPageOffset the rowIdPageOffset to set
+   */
+  public void setRowIdPageOffset(long rowIdPageOffset) {
+    this.rowIdPageOffset = rowIdPageOffset;
+  }
+
+  /**
+   * @return the rowIdPageLength
+   */
+  public int getRowIdPageLength() {
+    return rowIdPageLength;
+  }
+
+  /**
+   * @param rowIdPageLength the rowIdPageLength to set
+   */
+  public void setRowIdPageLength(int rowIdPageLength) {
+    this.rowIdPageLength = rowIdPageLength;
+  }
+
+  /**
+   * @return the rlePageOffset
+   */
+  public long getRlePageOffset() {
+    return rlePageOffset;
+  }
+
+  /**
+   * @param rlePageOffset the rlePageOffset to set
+   */
+  public void setRlePageOffset(long rlePageOffset) {
+    this.rlePageOffset = rlePageOffset;
+  }
+
+  /**
+   * @return the rlePageLength
+   */
+  public int getRlePageLength() {
+    return rlePageLength;
+  }
+
+  /**
+   * @param rlePageLength the rlePageLength to set
+   */
+  public void setRlePageLength(int rlePageLength) {
+    this.rlePageLength = rlePageLength;
+  }
+
+  /**
+   * @return the encoderList
+   */
+  public List<Encoding> getEncodingList() {
+    return encodingList;
+  }
+
+  /**
+   * @param encodingList the encoderList to set
+   */
+  public void setEncodingList(List<Encoding> encodingList) {
+    this.encodingList = encodingList;
+  }
+
+  /**
+   * @return the valueEncoderMeta
+   */
+  public List<ValueEncoderMeta> getValueEncoderMeta() {
+    return valueEncoderMetaList;
+  }
+
+  /**
+   * @param valueEncoderMetaList the valueEncoderMeta to set
+   */
+  public void setValueEncoderMeta(List<ValueEncoderMeta> valueEncoderMetaList) {
+    this.valueEncoderMetaList = valueEncoderMetaList;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/datachunk/PresenceMeta.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/datachunk/PresenceMeta.java b/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/datachunk/PresenceMeta.java
new file mode 100644
index 0000000..5c4548f
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/datachunk/PresenceMeta.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.metadata.blocklet.datachunk;
+
+import java.util.BitSet;
+
+/**
+ * information about presence of values in each row of the column chunk
+ */
+public class PresenceMeta {
+
+  /**
+   * if true, ones in the bit stream reprents presence. otherwise represents absence
+   */
+  private boolean representNullValues;
+
+  /**
+   * Compressed bit stream representing the presence of null values
+   */
+  private BitSet bitSet;
+
+  /**
+   * @return the representNullValues
+   */
+  public boolean isRepresentNullValues() {
+    return representNullValues;
+  }
+
+  /**
+   * @param representNullValues the representNullValues to set
+   */
+  public void setRepresentNullValues(boolean representNullValues) {
+    this.representNullValues = representNullValues;
+  }
+
+  /**
+   * @return the bitSet
+   */
+  public BitSet getBitSet() {
+    return bitSet;
+  }
+
+  /**
+   * @param bitSet the bitSet to set
+   */
+  public void setBitSet(BitSet bitSet) {
+    this.bitSet = bitSet;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/index/BlockletBTreeIndex.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/index/BlockletBTreeIndex.java b/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/index/BlockletBTreeIndex.java
new file mode 100644
index 0000000..e22b58b
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/index/BlockletBTreeIndex.java
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.carbondata.core.metadata.blocklet.index;
+
+import java.io.Serializable;
+
+/**
+ * Class hold the information about start and end key of one blocklet
+ */
+public class BlockletBTreeIndex implements Serializable {
+
+  /**
+   * serialization version
+   */
+  private static final long serialVersionUID = 6116185464700853045L;
+
+  /**
+   * Bit-packed start key of one blocklet
+   */
+  private byte[] startKey;
+
+  /**
+   * Bit-packed start key of one blocklet
+   */
+  private byte[] endKey;
+
+  public BlockletBTreeIndex() {
+  }
+
+  public BlockletBTreeIndex(byte[] startKey, byte[] endKey) {
+    this.startKey = startKey;
+    this.endKey = endKey;
+  }
+
+  /**
+   * @return the startKey
+   */
+  public byte[] getStartKey() {
+    return startKey;
+  }
+
+  /**
+   * @param startKey the startKey to set
+   */
+  public void setStartKey(byte[] startKey) {
+    this.startKey = startKey;
+  }
+
+  /**
+   * @return the endKey
+   */
+  public byte[] getEndKey() {
+    return endKey;
+  }
+
+  /**
+   * @param endKey the endKey to set
+   */
+  public void setEndKey(byte[] endKey) {
+    this.endKey = endKey;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/index/BlockletIndex.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/index/BlockletIndex.java b/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/index/BlockletIndex.java
new file mode 100644
index 0000000..7ee25eb
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/index/BlockletIndex.java
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.carbondata.core.metadata.blocklet.index;
+
+import java.io.Serializable;
+
+/**
+ * Persist Index of all blocklets in one file
+ */
+public class BlockletIndex implements Serializable {
+
+  /**
+   * serialization version
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * list of btree index for all the leaf
+   */
+  private BlockletBTreeIndex btreeIndex;
+
+  /**
+   * list of max and min key of all leaf
+   */
+  private BlockletMinMaxIndex minMaxIndex;
+
+  public BlockletIndex() {
+  }
+
+  public BlockletIndex(BlockletBTreeIndex btree, BlockletMinMaxIndex minmax) {
+    this.btreeIndex = btree;
+    this.minMaxIndex = minmax;
+  }
+
+  /**
+   * @return the btreeIndex
+   */
+  public BlockletBTreeIndex getBtreeIndex() {
+    return btreeIndex;
+  }
+
+  /**
+   * @param btreeIndex the btreeIndex to set
+   */
+  public void setBtreeIndex(BlockletBTreeIndex btreeIndex) {
+    this.btreeIndex = btreeIndex;
+  }
+
+  /**
+   * @return the minMaxIndex
+   */
+  public BlockletMinMaxIndex getMinMaxIndex() {
+    return minMaxIndex;
+  }
+
+  /**
+   * @param minMaxIndex the minMaxIndex to set
+   */
+  public void setMinMaxIndex(BlockletMinMaxIndex minMaxIndex) {
+    this.minMaxIndex = minMaxIndex;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/index/BlockletMinMaxIndex.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/index/BlockletMinMaxIndex.java b/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/index/BlockletMinMaxIndex.java
new file mode 100644
index 0000000..adf9720
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/blocklet/index/BlockletMinMaxIndex.java
@@ -0,0 +1,83 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.carbondata.core.metadata.blocklet.index;
+
+import java.io.Serializable;
+import java.nio.ByteBuffer;
+import java.util.List;
+
+/**
+ * Below class holds the information of max and min value of all the columns in a blocklet
+ */
+public class BlockletMinMaxIndex implements Serializable {
+
+  /**
+   * serialization version
+   */
+  private static final long serialVersionUID = -4311405145501302895L;
+
+  /**
+   * Min value of all columns of one blocklet Bit-Packed
+   */
+  private byte[][] minValues;
+
+  /**
+   * Max value of all columns of one blocklet Bit-Packed
+   */
+  private byte[][] maxValues;
+
+  public BlockletMinMaxIndex() {
+  }
+
+  public BlockletMinMaxIndex(List<ByteBuffer> minValues, List<ByteBuffer> maxValues) {
+    this.minValues = new byte[minValues.size()][];
+    this.maxValues = new byte[maxValues.size()][];
+    for (int i = 0; i < minValues.size(); i++) {
+      this.minValues[i] = minValues.get(i).array();
+      this.maxValues[i] = maxValues.get(i).array();
+    }
+  }
+
+  /**
+   * @return the minValues
+   */
+  public byte[][] getMinValues() {
+    return minValues;
+  }
+
+  /**
+   * @param minValues the minValues to set
+   */
+  public void setMinValues(byte[][] minValues) {
+    this.minValues = minValues;
+  }
+
+  /**
+   * @return the maxValues
+   */
+  public byte[][] getMaxValues() {
+    return maxValues;
+  }
+
+  /**
+   * @param maxValues the maxValues to set
+   */
+  public void setMaxValues(byte[][] maxValues) {
+    this.maxValues = maxValues;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/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
new file mode 100644
index 0000000..83a768b
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/converter/SchemaConverter.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.carbondata.core.metadata.converter;
+
+import org.apache.carbondata.core.metadata.schema.SchemaEvolution;
+import org.apache.carbondata.core.metadata.schema.SchemaEvolutionEntry;
+import org.apache.carbondata.core.metadata.schema.table.TableInfo;
+import org.apache.carbondata.core.metadata.schema.table.TableSchema;
+import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema;
+
+/**
+ * Converter interface which will be implemented for external to carbon schema
+ */
+public interface SchemaConverter {
+  /**
+   * @param wrapperSchemaEvolutionEntry
+   * @return
+   */
+  org.apache.carbondata.format.SchemaEvolutionEntry fromWrapperToExternalSchemaEvolutionEntry(
+      SchemaEvolutionEntry wrapperSchemaEvolutionEntry);
+
+  /**
+   * @param wrapperSchemaEvolution
+   * @return
+   */
+  org.apache.carbondata.format.SchemaEvolution fromWrapperToExternalSchemaEvolution(
+      SchemaEvolution wrapperSchemaEvolution);
+
+  /**
+   * @param wrapperColumnSchema
+   * @return
+   */
+  org.apache.carbondata.format.ColumnSchema fromWrapperToExternalColumnSchema(
+      ColumnSchema wrapperColumnSchema);
+
+  /**
+   * @param wrapperTableSchema
+   * @return
+   */
+  org.apache.carbondata.format.TableSchema fromWrapperToExternalTableSchema(
+      TableSchema wrapperTableSchema);
+
+  /**
+   * @param wrapperTableInfo
+   * @param dbName
+   * @param tableName
+   * @return
+   */
+  org.apache.carbondata.format.TableInfo fromWrapperToExternalTableInfo(TableInfo wrapperTableInfo,
+      String dbName, String tableName);
+
+  /**
+   * @param externalSchemaEvolutionEntry
+   * @return
+   */
+  SchemaEvolutionEntry fromExternalToWrapperSchemaEvolutionEntry(
+      org.apache.carbondata.format.SchemaEvolutionEntry externalSchemaEvolutionEntry);
+
+  /**
+   * @param externalSchemaEvolution
+   * @return
+   */
+  SchemaEvolution fromExternalToWrapperSchemaEvolution(
+      org.apache.carbondata.format.SchemaEvolution externalSchemaEvolution);
+
+  /**
+   * @param externalColumnSchema
+   * @return
+   */
+  ColumnSchema fromExternalToWrapperColumnSchema(
+      org.apache.carbondata.format.ColumnSchema externalColumnSchema);
+
+  /**
+   * @param externalTableSchema
+   * @param tableNam
+   * @return
+   */
+  TableSchema fromExternalToWrapperTableSchema(
+      org.apache.carbondata.format.TableSchema externalTableSchema, String tableNam);
+
+  /**
+   * @param externalTableInfo
+   * @param dbName
+   * @param tableName
+   * @return
+   */
+  TableInfo fromExternalToWrapperTableInfo(org.apache.carbondata.format.TableInfo externalTableInfo,
+      String dbName, String tableName, String storePath);
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/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
new file mode 100644
index 0000000..9370b4f
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/converter/ThriftWrapperSchemaConverterImpl.java
@@ -0,0 +1,424 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.carbondata.core.metadata.converter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.carbondata.core.metadata.datatype.DataType;
+import org.apache.carbondata.core.metadata.encoder.Encoding;
+import org.apache.carbondata.core.metadata.schema.BucketingInfo;
+import org.apache.carbondata.core.metadata.schema.SchemaEvolution;
+import org.apache.carbondata.core.metadata.schema.SchemaEvolutionEntry;
+import org.apache.carbondata.core.metadata.schema.table.TableInfo;
+import org.apache.carbondata.core.metadata.schema.table.TableSchema;
+import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema;
+
+/**
+ * Thrift schema to carbon schema converter and vice versa
+ */
+public class ThriftWrapperSchemaConverterImpl implements SchemaConverter {
+
+  /* (non-Javadoc)
+   * Converts  from wrapper to thrift schema evolution entry
+   */
+  @Override
+  public org.apache.carbondata.format.SchemaEvolutionEntry
+       fromWrapperToExternalSchemaEvolutionEntry(SchemaEvolutionEntry wrapperSchemaEvolutionEntry) {
+    org.apache.carbondata.format.SchemaEvolutionEntry thriftSchemaEvolutionEntry =
+        new org.apache.carbondata.format.SchemaEvolutionEntry(
+            wrapperSchemaEvolutionEntry.getTimeStamp());
+
+    List<org.apache.carbondata.format.ColumnSchema> thriftAddedColumns =
+        new ArrayList<org.apache.carbondata.format.ColumnSchema>();
+    for (ColumnSchema wrapperColumnSchema : wrapperSchemaEvolutionEntry.getAdded()) {
+      thriftAddedColumns.add(fromWrapperToExternalColumnSchema(wrapperColumnSchema));
+    }
+
+    List<org.apache.carbondata.format.ColumnSchema> thriftRemovedColumns =
+        new ArrayList<org.apache.carbondata.format.ColumnSchema>();
+    for (ColumnSchema wrapperColumnSchema : wrapperSchemaEvolutionEntry.getRemoved()) {
+      thriftRemovedColumns.add(fromWrapperToExternalColumnSchema(wrapperColumnSchema));
+    }
+
+    thriftSchemaEvolutionEntry.setAdded(thriftAddedColumns);
+    thriftSchemaEvolutionEntry.setRemoved(thriftRemovedColumns);
+    return thriftSchemaEvolutionEntry;
+  }
+
+  /* (non-Javadoc)
+   * converts from wrapper to thrift schema evolution
+   */
+  @Override
+  public org.apache.carbondata.format.SchemaEvolution fromWrapperToExternalSchemaEvolution(
+      SchemaEvolution wrapperSchemaEvolution) {
+
+    List<org.apache.carbondata.format.SchemaEvolutionEntry> thriftSchemaEvolEntryList =
+        new ArrayList<org.apache.carbondata.format.SchemaEvolutionEntry>();
+    for (SchemaEvolutionEntry schemaEvolutionEntry : wrapperSchemaEvolution
+        .getSchemaEvolutionEntryList()) {
+      thriftSchemaEvolEntryList
+          .add(fromWrapperToExternalSchemaEvolutionEntry(schemaEvolutionEntry));
+    }
+    return new org.apache.carbondata.format.SchemaEvolution(thriftSchemaEvolEntryList);
+  }
+
+  /**
+   * converts from wrapper to external encoding
+   *
+   * @param encoder
+   * @return
+   */
+  private org.apache.carbondata.format.Encoding fromWrapperToExternalEncoding(Encoding encoder) {
+
+    if (null == encoder) {
+      return null;
+    }
+
+    switch (encoder) {
+      case DICTIONARY:
+        return org.apache.carbondata.format.Encoding.DICTIONARY;
+      case DELTA:
+        return org.apache.carbondata.format.Encoding.DELTA;
+      case RLE:
+        return org.apache.carbondata.format.Encoding.RLE;
+      case INVERTED_INDEX:
+        return org.apache.carbondata.format.Encoding.INVERTED_INDEX;
+      case BIT_PACKED:
+        return org.apache.carbondata.format.Encoding.BIT_PACKED;
+      case DIRECT_DICTIONARY:
+        return org.apache.carbondata.format.Encoding.DIRECT_DICTIONARY;
+      default:
+        return org.apache.carbondata.format.Encoding.DICTIONARY;
+    }
+  }
+
+  /**
+   * convert from wrapper to external data type
+   *
+   * @param dataType
+   * @return
+   */
+  private org.apache.carbondata.format.DataType fromWrapperToExternalDataType(DataType dataType) {
+
+    if (null == dataType) {
+      return null;
+    }
+    switch (dataType) {
+      case STRING:
+        return org.apache.carbondata.format.DataType.STRING;
+      case INT:
+        return org.apache.carbondata.format.DataType.INT;
+      case SHORT:
+        return org.apache.carbondata.format.DataType.SHORT;
+      case LONG:
+        return org.apache.carbondata.format.DataType.LONG;
+      case DOUBLE:
+        return org.apache.carbondata.format.DataType.DOUBLE;
+      case DECIMAL:
+        return org.apache.carbondata.format.DataType.DECIMAL;
+      case DATE:
+        return org.apache.carbondata.format.DataType.DATE;
+      case TIMESTAMP:
+        return org.apache.carbondata.format.DataType.TIMESTAMP;
+      case ARRAY:
+        return org.apache.carbondata.format.DataType.ARRAY;
+      case STRUCT:
+        return org.apache.carbondata.format.DataType.STRUCT;
+      default:
+        return org.apache.carbondata.format.DataType.STRING;
+    }
+  }
+
+  /* (non-Javadoc)
+   * convert from wrapper to external column schema
+   */
+  @Override public org.apache.carbondata.format.ColumnSchema fromWrapperToExternalColumnSchema(
+      ColumnSchema wrapperColumnSchema) {
+
+    List<org.apache.carbondata.format.Encoding> encoders =
+        new ArrayList<org.apache.carbondata.format.Encoding>();
+    for (Encoding encoder : wrapperColumnSchema.getEncodingList()) {
+      encoders.add(fromWrapperToExternalEncoding(encoder));
+    }
+    org.apache.carbondata.format.ColumnSchema thriftColumnSchema =
+        new org.apache.carbondata.format.ColumnSchema(
+            fromWrapperToExternalDataType(wrapperColumnSchema.getDataType()),
+            wrapperColumnSchema.getColumnName(), wrapperColumnSchema.getColumnUniqueId(),
+            wrapperColumnSchema.isColumnar(), encoders, wrapperColumnSchema.isDimensionColumn());
+    thriftColumnSchema.setColumn_group_id(wrapperColumnSchema.getColumnGroupId());
+    thriftColumnSchema.setScale(wrapperColumnSchema.getScale());
+    thriftColumnSchema.setPrecision(wrapperColumnSchema.getPrecision());
+    thriftColumnSchema.setNum_child(wrapperColumnSchema.getNumberOfChild());
+    thriftColumnSchema.setDefault_value(wrapperColumnSchema.getDefaultValue());
+    thriftColumnSchema.setColumnProperties(wrapperColumnSchema.getColumnProperties());
+    thriftColumnSchema.setInvisible(wrapperColumnSchema.isInvisible());
+    thriftColumnSchema.setColumnReferenceId(wrapperColumnSchema.getColumnReferenceId());
+    thriftColumnSchema.setSchemaOrdinal(wrapperColumnSchema.getSchemaOrdinal());
+    return thriftColumnSchema;
+  }
+
+  /* (non-Javadoc)
+   * convert from wrapper to external tableschema
+   */
+  @Override public org.apache.carbondata.format.TableSchema fromWrapperToExternalTableSchema(
+      TableSchema wrapperTableSchema) {
+
+    List<org.apache.carbondata.format.ColumnSchema> thriftColumnSchema =
+        new ArrayList<org.apache.carbondata.format.ColumnSchema>();
+    for (ColumnSchema wrapperColumnSchema : wrapperTableSchema.getListOfColumns()) {
+      thriftColumnSchema.add(fromWrapperToExternalColumnSchema(wrapperColumnSchema));
+    }
+    org.apache.carbondata.format.SchemaEvolution schemaEvolution =
+        fromWrapperToExternalSchemaEvolution(wrapperTableSchema.getSchemaEvalution());
+    org.apache.carbondata.format.TableSchema externalTableSchema =
+        new org.apache.carbondata.format.TableSchema(
+            wrapperTableSchema.getTableId(), thriftColumnSchema, schemaEvolution);
+    externalTableSchema.setTableProperties(wrapperTableSchema.getTableProperties());
+    if (wrapperTableSchema.getBucketingInfo() != null) {
+      externalTableSchema.setBucketingInfo(
+          fromWrapperToExternalBucketingInfo(wrapperTableSchema.getBucketingInfo()));
+    }
+    return externalTableSchema;
+  }
+
+  private org.apache.carbondata.format.BucketingInfo fromWrapperToExternalBucketingInfo(
+      BucketingInfo bucketingInfo) {
+    List<org.apache.carbondata.format.ColumnSchema> thriftColumnSchema =
+        new ArrayList<org.apache.carbondata.format.ColumnSchema>();
+    for (ColumnSchema wrapperColumnSchema : bucketingInfo.getListOfColumns()) {
+      thriftColumnSchema.add(fromWrapperToExternalColumnSchema(wrapperColumnSchema));
+    }
+    return new org.apache.carbondata.format.BucketingInfo(thriftColumnSchema,
+        bucketingInfo.getNumberOfBuckets());
+  }
+
+  /* (non-Javadoc)
+   * convert from wrapper to external tableinfo
+   */
+  @Override public org.apache.carbondata.format.TableInfo fromWrapperToExternalTableInfo(
+      TableInfo wrapperTableInfo, String dbName, String tableName) {
+
+    org.apache.carbondata.format.TableSchema thriftFactTable =
+        fromWrapperToExternalTableSchema(wrapperTableInfo.getFactTable());
+    List<org.apache.carbondata.format.TableSchema> thriftAggTables =
+        new ArrayList<org.apache.carbondata.format.TableSchema>();
+    for (TableSchema wrapperAggTableSchema : wrapperTableInfo.getAggregateTableList()) {
+      thriftAggTables.add(fromWrapperToExternalTableSchema(wrapperAggTableSchema));
+    }
+    return new org.apache.carbondata.format.TableInfo(thriftFactTable, thriftAggTables);
+  }
+
+  /* (non-Javadoc)
+   * convert from external to wrapper schema evolution entry
+   */
+  @Override public SchemaEvolutionEntry fromExternalToWrapperSchemaEvolutionEntry(
+      org.apache.carbondata.format.SchemaEvolutionEntry externalSchemaEvolutionEntry) {
+
+    SchemaEvolutionEntry wrapperSchemaEvolutionEntry = new SchemaEvolutionEntry();
+    wrapperSchemaEvolutionEntry.setTimeStamp(externalSchemaEvolutionEntry.getTime_stamp());
+
+    List<ColumnSchema> wrapperAddedColumns = new ArrayList<ColumnSchema>();
+    if (null != externalSchemaEvolutionEntry.getAdded()) {
+      for (org.apache.carbondata.format.ColumnSchema externalColumnSchema :
+          externalSchemaEvolutionEntry.getAdded()) {
+        wrapperAddedColumns.add(fromExternalToWrapperColumnSchema(externalColumnSchema));
+      }
+    }
+    List<ColumnSchema> wrapperRemovedColumns = new ArrayList<ColumnSchema>();
+    if (null != externalSchemaEvolutionEntry.getRemoved()) {
+      for (org.apache.carbondata.format.ColumnSchema externalColumnSchema :
+          externalSchemaEvolutionEntry.getRemoved()) {
+        wrapperRemovedColumns.add(fromExternalToWrapperColumnSchema(externalColumnSchema));
+      }
+    }
+
+    wrapperSchemaEvolutionEntry.setAdded(wrapperAddedColumns);
+    wrapperSchemaEvolutionEntry.setRemoved(wrapperRemovedColumns);
+    return wrapperSchemaEvolutionEntry;
+
+  }
+
+  /* (non-Javadoc)
+   * convert from external to wrapper schema evolution
+   */
+  @Override public SchemaEvolution fromExternalToWrapperSchemaEvolution(
+      org.apache.carbondata.format.SchemaEvolution externalSchemaEvolution) {
+    List<SchemaEvolutionEntry> wrapperSchemaEvolEntryList = new ArrayList<SchemaEvolutionEntry>();
+    for (org.apache.carbondata.format.SchemaEvolutionEntry schemaEvolutionEntry :
+        externalSchemaEvolution.getSchema_evolution_history()) {
+      wrapperSchemaEvolEntryList
+          .add(fromExternalToWrapperSchemaEvolutionEntry(schemaEvolutionEntry));
+    }
+    SchemaEvolution wrapperSchemaEvolution = new SchemaEvolution();
+    wrapperSchemaEvolution.setSchemaEvolutionEntryList(wrapperSchemaEvolEntryList);
+    return wrapperSchemaEvolution;
+  }
+
+  /**
+   * convert from external to wrapper encoding
+   *
+   * @param encoder
+   * @return
+   */
+  private Encoding fromExternalToWrapperEncoding(org.apache.carbondata.format.Encoding encoder) {
+    if (null == encoder) {
+      return null;
+    }
+    switch (encoder) {
+      case DICTIONARY:
+        return Encoding.DICTIONARY;
+      case DELTA:
+        return Encoding.DELTA;
+      case RLE:
+        return Encoding.RLE;
+      case INVERTED_INDEX:
+        return Encoding.INVERTED_INDEX;
+      case BIT_PACKED:
+        return Encoding.BIT_PACKED;
+      case DIRECT_DICTIONARY:
+        return Encoding.DIRECT_DICTIONARY;
+      default:
+        return Encoding.DICTIONARY;
+    }
+  }
+
+  /**
+   * convert from external to wrapper data type
+   *
+   * @param dataType
+   * @return
+   */
+  private DataType fromExternalToWrapperDataType(org.apache.carbondata.format.DataType dataType) {
+    if (null == dataType) {
+      return null;
+    }
+    switch (dataType) {
+      case STRING:
+        return DataType.STRING;
+      case INT:
+        return DataType.INT;
+      case SHORT:
+        return DataType.SHORT;
+      case LONG:
+        return DataType.LONG;
+      case DOUBLE:
+        return DataType.DOUBLE;
+      case DECIMAL:
+        return DataType.DECIMAL;
+      case TIMESTAMP:
+        return DataType.TIMESTAMP;
+      case DATE:
+        return DataType.DATE;
+      case ARRAY:
+        return DataType.ARRAY;
+      case STRUCT:
+        return DataType.STRUCT;
+      default:
+        return DataType.STRING;
+    }
+  }
+
+  /* (non-Javadoc)
+   * convert from external to wrapper columnschema
+   */
+  @Override public ColumnSchema fromExternalToWrapperColumnSchema(
+      org.apache.carbondata.format.ColumnSchema externalColumnSchema) {
+    ColumnSchema wrapperColumnSchema = new ColumnSchema();
+    wrapperColumnSchema.setColumnUniqueId(externalColumnSchema.getColumn_id());
+    wrapperColumnSchema.setColumnName(externalColumnSchema.getColumn_name());
+    wrapperColumnSchema.setColumnar(externalColumnSchema.isColumnar());
+    wrapperColumnSchema.setDataType(fromExternalToWrapperDataType(externalColumnSchema.data_type));
+    wrapperColumnSchema.setDimensionColumn(externalColumnSchema.isDimension());
+    List<Encoding> encoders = new ArrayList<Encoding>();
+    for (org.apache.carbondata.format.Encoding encoder : externalColumnSchema.getEncoders()) {
+      encoders.add(fromExternalToWrapperEncoding(encoder));
+    }
+    wrapperColumnSchema.setEncodingList(encoders);
+    wrapperColumnSchema.setNumberOfChild(externalColumnSchema.getNum_child());
+    wrapperColumnSchema.setPrecision(externalColumnSchema.getPrecision());
+    wrapperColumnSchema.setColumnGroup(externalColumnSchema.getColumn_group_id());
+    wrapperColumnSchema.setScale(externalColumnSchema.getScale());
+    wrapperColumnSchema.setDefaultValue(externalColumnSchema.getDefault_value());
+    wrapperColumnSchema.setInvisible(externalColumnSchema.isInvisible());
+    wrapperColumnSchema.setColumnReferenceId(externalColumnSchema.getColumnReferenceId());
+    wrapperColumnSchema.setSchemaOrdinal(externalColumnSchema.getSchemaOrdinal());
+    return wrapperColumnSchema;
+  }
+
+  /* (non-Javadoc)
+   * convert from external to wrapper tableschema
+   */
+  @Override public TableSchema fromExternalToWrapperTableSchema(
+      org.apache.carbondata.format.TableSchema externalTableSchema, String tableName) {
+    TableSchema wrapperTableSchema = new TableSchema();
+    wrapperTableSchema.setTableId(externalTableSchema.getTable_id());
+    wrapperTableSchema.setTableName(tableName);
+    wrapperTableSchema.setTableProperties(externalTableSchema.getTableProperties());
+    List<ColumnSchema> listOfColumns = new ArrayList<ColumnSchema>();
+    for (org.apache.carbondata.format.ColumnSchema externalColumnSchema : externalTableSchema
+        .getTable_columns()) {
+      listOfColumns.add(fromExternalToWrapperColumnSchema(externalColumnSchema));
+    }
+    wrapperTableSchema.setListOfColumns(listOfColumns);
+    wrapperTableSchema.setSchemaEvalution(
+        fromExternalToWrapperSchemaEvolution(externalTableSchema.getSchema_evolution()));
+    if (externalTableSchema.isSetBucketingInfo()) {
+      wrapperTableSchema.setBucketingInfo(
+          fromExternalToWarpperBucketingInfo(externalTableSchema.bucketingInfo));
+    }
+    return wrapperTableSchema;
+  }
+
+  private BucketingInfo fromExternalToWarpperBucketingInfo(
+      org.apache.carbondata.format.BucketingInfo externalBucketInfo) {
+    List<ColumnSchema> listOfColumns = new ArrayList<ColumnSchema>();
+    for (org.apache.carbondata.format.ColumnSchema externalColumnSchema :
+          externalBucketInfo.table_columns) {
+      listOfColumns.add(fromExternalToWrapperColumnSchema(externalColumnSchema));
+    }
+    return new BucketingInfo(listOfColumns, externalBucketInfo.number_of_buckets);
+  }
+
+  /* (non-Javadoc)
+   * convert from external to wrapper tableinfo
+   */
+  @Override public TableInfo fromExternalToWrapperTableInfo(
+      org.apache.carbondata.format.TableInfo externalTableInfo, String dbName, String tableName,
+      String storePath) {
+    TableInfo wrapperTableInfo = new TableInfo();
+    wrapperTableInfo.setLastUpdatedTime(
+        externalTableInfo.getFact_table().getSchema_evolution().getSchema_evolution_history().get(0)
+            .getTime_stamp());
+    wrapperTableInfo.setDatabaseName(dbName);
+    wrapperTableInfo.setTableUniqueName(dbName + "_" + tableName);
+    wrapperTableInfo.setStorePath(storePath);
+    wrapperTableInfo.setFactTable(
+        fromExternalToWrapperTableSchema(externalTableInfo.getFact_table(), tableName));
+    List<TableSchema> aggTablesList = new ArrayList<TableSchema>();
+    int index = 0;
+    for (org.apache.carbondata.format.TableSchema aggTable : externalTableInfo
+        .getAggregate_table_list()) {
+      aggTablesList.add(fromExternalToWrapperTableSchema(aggTable, "agg_table_" + index));
+      index++;
+    }
+    return wrapperTableInfo;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataType.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataType.java b/core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataType.java
new file mode 100644
index 0000000..13cff71
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/datatype/DataType.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.metadata.datatype;
+
+public enum DataType {
+
+  STRING(0, "STRING"),
+  DATE(1, "DATE"),
+  TIMESTAMP(2, "TIMESTAMP"),
+  BOOLEAN(1, "BOOLEAN"),
+  SHORT(2, "SMALLINT"),
+  INT(3, "INT"),
+  FLOAT(4, "FLOAT"),
+  LONG(5, "BIGINT"),
+  DOUBLE(6, "DOUBLE"),
+  NULL(7, "NULL"),
+  DECIMAL(8, "DECIMAL"),
+  ARRAY(9, "ARRAY"),
+  STRUCT(10, "STRUCT"),
+  MAP(11, "MAP");
+
+  private int precedenceOrder;
+  private String name ;
+
+  DataType(int value ,String  name) {
+    this.precedenceOrder = value;
+    this.name = name;
+  }
+
+  public int getPrecedenceOrder() {
+    return precedenceOrder;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public boolean isComplexType() {
+    return precedenceOrder >= 9 && precedenceOrder <= 11;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/core/metadata/encoder/Encoding.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/encoder/Encoding.java b/core/src/main/java/org/apache/carbondata/core/metadata/encoder/Encoding.java
new file mode 100644
index 0000000..eb3f57d
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/encoder/Encoding.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.carbondata.core.metadata.encoder;
+
+/**
+ * Encoding type supported in carbon
+ */
+public enum Encoding {
+  DICTIONARY,
+  DELTA,
+  RLE,
+  INVERTED_INDEX,
+  BIT_PACKED,
+  DIRECT_DICTIONARY,
+  IMPLICIT;
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/core/metadata/index/BlockIndexInfo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/index/BlockIndexInfo.java b/core/src/main/java/org/apache/carbondata/core/metadata/index/BlockIndexInfo.java
new file mode 100644
index 0000000..d070774
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/index/BlockIndexInfo.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.carbondata.core.metadata.index;
+
+import org.apache.carbondata.core.metadata.blocklet.index.BlockletIndex;
+
+/**
+ * Below class will be used hold the information
+ * about block index
+ */
+public class BlockIndexInfo {
+
+  /**
+   * total number of rows present in the file
+   */
+  private long numberOfRows;
+
+  /**
+   * file name
+   */
+  private String fileName;
+
+  /**
+   * offset of metadata in data file
+   */
+  private long offset;
+
+  /**
+   * to store min max and start and end key
+   */
+  private BlockletIndex blockletIndex;
+
+  /**
+   * Constructor
+   *
+   * @param numberOfRows  number of rows
+   * @param fileName      full qualified name
+   * @param offset        offset of the metadata in data file
+   * @param blockletIndex block let index
+   */
+  public BlockIndexInfo(long numberOfRows, String fileName, long offset,
+      BlockletIndex blockletIndex) {
+    this.numberOfRows = numberOfRows;
+    this.fileName = fileName;
+    this.offset = offset;
+    this.blockletIndex = blockletIndex;
+  }
+
+  /**
+   * @return the numberOfRows
+   */
+  public long getNumberOfRows() {
+    return numberOfRows;
+  }
+
+  /**
+   * @return the fileName
+   */
+  public String getFileName() {
+    return fileName;
+  }
+
+  /**
+   * @return the offset
+   */
+  public long getOffset() {
+    return offset;
+  }
+
+  /**
+   * @return the blockletIndex
+   */
+  public BlockletIndex getBlockletIndex() {
+    return blockletIndex;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/core/metadata/schema/BucketingInfo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/schema/BucketingInfo.java b/core/src/main/java/org/apache/carbondata/core/metadata/schema/BucketingInfo.java
new file mode 100644
index 0000000..433da97
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/schema/BucketingInfo.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.metadata.schema;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema;
+
+/**
+ * Bucketing information
+ */
+public class BucketingInfo implements Serializable {
+
+  private List<ColumnSchema> listOfColumns;
+
+  private int numberOfBuckets;
+
+  public BucketingInfo(List<ColumnSchema> listOfColumns, int numberOfBuckets) {
+    this.listOfColumns = listOfColumns;
+    this.numberOfBuckets = numberOfBuckets;
+  }
+
+  public List<ColumnSchema> getListOfColumns() {
+    return listOfColumns;
+  }
+
+  public int getNumberOfBuckets() {
+    return numberOfBuckets;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/core/metadata/schema/SchemaEvolution.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/schema/SchemaEvolution.java b/core/src/main/java/org/apache/carbondata/core/metadata/schema/SchemaEvolution.java
new file mode 100644
index 0000000..5f3a9e1
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/schema/SchemaEvolution.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.carbondata.core.metadata.schema;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Persisting schema restructuring information;
+ */
+public class SchemaEvolution implements Serializable {
+
+  /**
+   * serialization version
+   */
+  private static final long serialVersionUID = 8186224567517679868L;
+
+  /**
+   * list of schema evolution entry
+   */
+  private List<SchemaEvolutionEntry> schemaEvolutionEntryList;
+
+  /**
+   * @return the schemaEvolutionEntryList
+   */
+  public List<SchemaEvolutionEntry> getSchemaEvolutionEntryList() {
+    return schemaEvolutionEntryList;
+  }
+
+  /**
+   * @param schemaEvolutionEntryList the schemaEvolutionEntryList to set
+   */
+  public void setSchemaEvolutionEntryList(List<SchemaEvolutionEntry> schemaEvolutionEntryList) {
+    this.schemaEvolutionEntryList = schemaEvolutionEntryList;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/core/metadata/schema/SchemaEvolutionEntry.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/schema/SchemaEvolutionEntry.java b/core/src/main/java/org/apache/carbondata/core/metadata/schema/SchemaEvolutionEntry.java
new file mode 100644
index 0000000..0a96588
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/schema/SchemaEvolutionEntry.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.carbondata.core.metadata.schema;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema;
+
+/**
+ * Store the infomation about the schema evolution
+ */
+public class SchemaEvolutionEntry implements Serializable {
+
+  /**
+   * serilization version
+   */
+  private static final long serialVersionUID = -7619477063676325276L;
+
+  /**
+   * time stamp of restructuring
+   */
+  private long timeStamp;
+
+  /**
+   * new column added in restructuring
+   */
+  private List<ColumnSchema> added;
+
+  /**
+   * column removed in restructuring
+   */
+  private List<ColumnSchema> removed;
+
+  /**
+   * @return the timeStamp
+   */
+  public long getTimeStamp() {
+    return timeStamp;
+  }
+
+  /**
+   * @param timeStamp the timeStamp to set
+   */
+  public void setTimeStamp(long timeStamp) {
+    this.timeStamp = timeStamp;
+  }
+
+  /**
+   * @return the added
+   */
+  public List<ColumnSchema> getAdded() {
+    return added;
+  }
+
+  /**
+   * @param added the added to set
+   */
+  public void setAdded(List<ColumnSchema> added) {
+    this.added = added;
+  }
+
+  /**
+   * @return the removed
+   */
+  public List<ColumnSchema> getRemoved() {
+    return removed;
+  }
+
+  /**
+   * @param removed the removed to set
+   */
+  public void setRemoved(List<ColumnSchema> removed) {
+    this.removed = removed;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/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
new file mode 100644
index 0000000..ff6bd74
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java
@@ -0,0 +1,585 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.carbondata.core.metadata.schema.table;
+
+import java.io.Serializable;
+import java.util.*;
+
+import org.apache.carbondata.common.logging.LogService;
+import org.apache.carbondata.common.logging.LogServiceFactory;
+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.encoder.Encoding;
+import org.apache.carbondata.core.metadata.schema.BucketingInfo;
+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.CarbonImplicitDimension;
+import org.apache.carbondata.core.metadata.schema.table.column.CarbonMeasure;
+import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema;
+
+/**
+ * Mapping class for Carbon actual table
+ */
+public class CarbonTable implements Serializable {
+
+  /**
+   * serialization id
+   */
+  private static final long serialVersionUID = 8696507171227156445L;
+
+  /**
+   * Attribute for Carbon table LOGGER
+   */
+  private static final LogService LOGGER =
+      LogServiceFactory.getLogService(CarbonTable.class.getName());
+
+  /**
+   * Absolute table identifier
+   */
+  private AbsoluteTableIdentifier absoluteTableIdentifier;
+
+  /**
+   * TableName, Dimensions list
+   */
+  private Map<String, List<CarbonDimension>> tableDimensionsMap;
+
+  private Map<String, List<CarbonColumn>> createOrderColumn;
+  /**
+   * TableName, Dimensions and children dimensions list
+   */
+  private Map<String, List<CarbonDimension>> tablePrimitiveDimensionsMap;
+
+  /**
+   * table measures list.
+   */
+  private Map<String, List<CarbonDimension>> tableImplicitDimensionsMap;
+
+  /**
+   * table measures list.
+   */
+  private Map<String, List<CarbonMeasure>> tableMeasuresMap;
+
+  /**
+   * table bucket map.
+   */
+  private Map<String, BucketingInfo> tableBucketMap;
+
+  /**
+   * tableUniqueName
+   */
+  private String tableUniqueName;
+
+  /**
+   * Aggregate tables name
+   */
+  private List<String> aggregateTablesName;
+
+  /**
+   * metadata file path (check if it is really required )
+   */
+  private String metaDataFilepath;
+
+  /**
+   * last updated time
+   */
+  private long tableLastUpdatedTime;
+
+  /**
+   * table block size in MB
+   */
+  private int blockSize;
+
+  public CarbonTable() {
+    this.tableDimensionsMap = new HashMap<String, List<CarbonDimension>>();
+    this.tableImplicitDimensionsMap = new HashMap<String, List<CarbonDimension>>();
+    this.tableMeasuresMap = new HashMap<String, List<CarbonMeasure>>();
+    this.tableBucketMap = new HashMap<>();
+    this.aggregateTablesName = new ArrayList<String>();
+    this.createOrderColumn = new HashMap<String, List<CarbonColumn>>();
+    this.tablePrimitiveDimensionsMap = new HashMap<String, List<CarbonDimension>>();
+  }
+
+  /**
+   * @param tableInfo
+   */
+  public void loadCarbonTable(TableInfo tableInfo) {
+    this.blockSize = getTableBlockSizeInMB(tableInfo);
+    this.tableLastUpdatedTime = tableInfo.getLastUpdatedTime();
+    this.tableUniqueName = tableInfo.getTableUniqueName();
+    this.metaDataFilepath = tableInfo.getMetaDataFilepath();
+    //setting unique table identifier
+    CarbonTableIdentifier carbontableIdentifier =
+        new CarbonTableIdentifier(tableInfo.getDatabaseName(),
+            tableInfo.getFactTable().getTableName(), tableInfo.getFactTable().getTableId());
+    this.absoluteTableIdentifier =
+        new AbsoluteTableIdentifier(tableInfo.getStorePath(), carbontableIdentifier);
+
+    fillDimensionsAndMeasuresForTables(tableInfo.getFactTable());
+    fillCreateOrderColumn(tableInfo.getFactTable().getTableName());
+    List<TableSchema> aggregateTableList = tableInfo.getAggregateTableList();
+    for (TableSchema aggTable : aggregateTableList) {
+      this.aggregateTablesName.add(aggTable.getTableName());
+      fillDimensionsAndMeasuresForTables(aggTable);
+      tableBucketMap.put(aggTable.getTableName(), aggTable.getBucketingInfo());
+    }
+    tableBucketMap.put(tableInfo.getFactTable().getTableName(),
+        tableInfo.getFactTable().getBucketingInfo());
+  }
+
+  /**
+   * fill columns as per user provided order
+   * @param tableName
+   */
+  private void fillCreateOrderColumn(String tableName) {
+    List<CarbonColumn> columns = new ArrayList<CarbonColumn>();
+    List<CarbonDimension> dimensions = this.tableDimensionsMap.get(tableName);
+    List<CarbonMeasure> measures = this.tableMeasuresMap.get(tableName);
+    Iterator<CarbonDimension> dimItr = dimensions.iterator();
+    while (dimItr.hasNext()) {
+      columns.add(dimItr.next());
+    }
+    Iterator<CarbonMeasure> msrItr = measures.iterator();
+    while (msrItr.hasNext()) {
+      columns.add(msrItr.next());
+    }
+    Collections.sort(columns, new Comparator<CarbonColumn>() {
+
+      @Override public int compare(CarbonColumn o1, CarbonColumn o2) {
+
+        return Integer.compare(o1.getSchemaOrdinal(), o2.getSchemaOrdinal());
+      }
+
+    });
+    this.createOrderColumn.put(tableName, columns);
+  }
+
+  /**
+   * This method will return the table size. Default table block size will be considered
+   * in case not specified by the user
+   *
+   * @param tableInfo
+   * @return
+   */
+  private int getTableBlockSizeInMB(TableInfo tableInfo) {
+    String tableBlockSize = null;
+    // In case of old store there will not be any map for table properties so table properties
+    // will be null
+    Map<String, String> tableProperties = tableInfo.getFactTable().getTableProperties();
+    if (null != tableProperties) {
+      tableBlockSize = tableProperties.get(CarbonCommonConstants.TABLE_BLOCKSIZE);
+    }
+    if (null == tableBlockSize) {
+      tableBlockSize = CarbonCommonConstants.BLOCK_SIZE_DEFAULT_VAL;
+      LOGGER.info("Table block size not specified for " + tableInfo.getTableUniqueName()
+          + ". Therefore considering the default value "
+          + CarbonCommonConstants.BLOCK_SIZE_DEFAULT_VAL + " MB");
+    }
+    return Integer.parseInt(tableBlockSize);
+  }
+
+  /**
+   * Fill dimensions and measures for carbon table
+   *
+   * @param tableSchema
+   */
+  private void fillDimensionsAndMeasuresForTables(TableSchema tableSchema) {
+    List<CarbonDimension> dimensions = new ArrayList<CarbonDimension>();
+    List<CarbonDimension> primitiveDimensions = new ArrayList<CarbonDimension>();
+    List<CarbonDimension> implicitDimensions = new ArrayList<CarbonDimension>();
+    List<CarbonMeasure> measures = new ArrayList<CarbonMeasure>();
+    this.tableDimensionsMap.put(tableSchema.getTableName(), dimensions);
+    this.tablePrimitiveDimensionsMap.put(this.tableUniqueName, primitiveDimensions);
+    this.tableMeasuresMap.put(tableSchema.getTableName(), measures);
+    this.tableImplicitDimensionsMap.put(tableSchema.getTableName(), implicitDimensions);
+    int dimensionOrdinal = 0;
+    int measureOrdinal = 0;
+    int keyOrdinal = 0;
+    int columnGroupOrdinal = -1;
+    int previousColumnGroupId = -1;
+    List<ColumnSchema> listOfColumns = tableSchema.getListOfColumns();
+    int complexTypeOrdinal = -1;
+    for (int i = 0; i < listOfColumns.size(); i++) {
+      ColumnSchema columnSchema = listOfColumns.get(i);
+      if (columnSchema.isDimensionColumn()) {
+        if (columnSchema.getNumberOfChild() > 0) {
+          CarbonDimension complexDimension =
+              new CarbonDimension(columnSchema, dimensionOrdinal++,
+                    columnSchema.getSchemaOrdinal(), -1, -1, ++complexTypeOrdinal);
+          complexDimension.initializeChildDimensionsList(columnSchema.getNumberOfChild());
+          dimensions.add(complexDimension);
+          dimensionOrdinal =
+              readAllComplexTypeChildrens(dimensionOrdinal, columnSchema.getNumberOfChild(),
+                  listOfColumns, complexDimension, primitiveDimensions);
+          i = dimensionOrdinal - 1;
+          complexTypeOrdinal = assignComplexOrdinal(complexDimension, complexTypeOrdinal);
+        } else {
+          if (!columnSchema.getEncodingList().contains(Encoding.DICTIONARY)) {
+            CarbonDimension dimension =
+                    new CarbonDimension(columnSchema, dimensionOrdinal++,
+                            columnSchema.getSchemaOrdinal(), -1, -1, -1);
+            dimensions.add(dimension);
+            primitiveDimensions.add(dimension);
+          } else if (columnSchema.getEncodingList().contains(Encoding.DICTIONARY)
+              && columnSchema.getColumnGroupId() == -1) {
+            CarbonDimension dimension =
+                    new CarbonDimension(columnSchema, dimensionOrdinal++,
+                            columnSchema.getSchemaOrdinal(), keyOrdinal++, -1, -1);
+            dimensions.add(dimension);
+            primitiveDimensions.add(dimension);
+          } else {
+            columnGroupOrdinal =
+                previousColumnGroupId == columnSchema.getColumnGroupId() ? ++columnGroupOrdinal : 0;
+            previousColumnGroupId = columnSchema.getColumnGroupId();
+            CarbonDimension dimension = new CarbonDimension(columnSchema, dimensionOrdinal++,
+                    columnSchema.getSchemaOrdinal(), keyOrdinal++,
+                    columnGroupOrdinal, -1);
+            dimensions.add(dimension);
+            primitiveDimensions.add(dimension);
+          }
+        }
+      } else {
+        measures.add(new CarbonMeasure(columnSchema, measureOrdinal++,
+                 columnSchema.getSchemaOrdinal()));
+      }
+    }
+    addImplicitDimension(dimensionOrdinal, implicitDimensions);
+  }
+
+  /**
+   * This method will add implict dimension into carbontable
+   *
+   * @param dimensionOrdinal
+   * @param dimensions
+   */
+  private void addImplicitDimension(int dimensionOrdinal, List<CarbonDimension> dimensions) {
+    dimensions.add(new CarbonImplicitDimension(dimensionOrdinal,
+        CarbonCommonConstants.CARBON_IMPLICIT_COLUMN_POSITIONID));
+    dimensions.add(new CarbonImplicitDimension(dimensionOrdinal+1,
+        CarbonCommonConstants.CARBON_IMPLICIT_COLUMN_TUPLEID));
+  }
+
+  /**
+   * Read all primitive/complex children and set it as list of child carbon dimension to parent
+   * dimension
+   *
+   * @param dimensionOrdinal
+   * @param childCount
+   * @param listOfColumns
+   * @param parentDimension
+   * @return
+   */
+  private int readAllComplexTypeChildrens(int dimensionOrdinal, int childCount,
+      List<ColumnSchema> listOfColumns, CarbonDimension parentDimension,
+                                          List<CarbonDimension> primitiveDimensions) {
+    for (int i = 0; i < childCount; i++) {
+      ColumnSchema columnSchema = listOfColumns.get(dimensionOrdinal);
+      if (columnSchema.isDimensionColumn()) {
+        if (columnSchema.getNumberOfChild() > 0) {
+          CarbonDimension complexDimension =
+              new CarbonDimension(columnSchema, dimensionOrdinal++,
+                        columnSchema.getSchemaOrdinal(), -1, -1, -1);
+          complexDimension.initializeChildDimensionsList(columnSchema.getNumberOfChild());
+          parentDimension.getListOfChildDimensions().add(complexDimension);
+          dimensionOrdinal =
+              readAllComplexTypeChildrens(dimensionOrdinal, columnSchema.getNumberOfChild(),
+                  listOfColumns, complexDimension, primitiveDimensions);
+        } else {
+          CarbonDimension carbonDimension =
+                  new CarbonDimension(columnSchema, dimensionOrdinal++,
+                          columnSchema.getSchemaOrdinal(), -1, -1, -1);
+          parentDimension.getListOfChildDimensions().add(carbonDimension);
+          primitiveDimensions.add(carbonDimension);
+        }
+      }
+    }
+    return dimensionOrdinal;
+  }
+
+  /**
+   * Read all primitive/complex children and set it as list of child carbon dimension to parent
+   * dimension
+   */
+  private int assignComplexOrdinal(CarbonDimension parentDimension, int complexDimensionOrdianl) {
+    for (int i = 0; i < parentDimension.getNumberOfChild(); i++) {
+      CarbonDimension dimension = parentDimension.getListOfChildDimensions().get(i);
+      if (dimension.getNumberOfChild() > 0) {
+        dimension.setComplexTypeOridnal(++complexDimensionOrdianl);
+        complexDimensionOrdianl = assignComplexOrdinal(dimension, complexDimensionOrdianl);
+      } else {
+        parentDimension.getListOfChildDimensions().get(i)
+            .setComplexTypeOridnal(++complexDimensionOrdianl);
+      }
+    }
+    return complexDimensionOrdianl;
+  }
+
+  /**
+   * @return the databaseName
+   */
+  public String getDatabaseName() {
+    return absoluteTableIdentifier.getCarbonTableIdentifier().getDatabaseName();
+  }
+
+  /**
+   * @return the tabelName
+   */
+  public String getFactTableName() {
+    return absoluteTableIdentifier.getCarbonTableIdentifier().getTableName();
+  }
+
+  /**
+   * @return the tableUniqueName
+   */
+  public String getTableUniqueName() {
+    return tableUniqueName;
+  }
+
+  /**
+   * @return the metaDataFilepath
+   */
+  public String getMetaDataFilepath() {
+    return metaDataFilepath;
+  }
+
+  /**
+   * @return storepath
+   */
+  public String getStorePath() {
+    return absoluteTableIdentifier.getStorePath();
+  }
+
+  /**
+   * @return list of aggregate TablesName
+   */
+  public List<String> getAggregateTablesName() {
+    return aggregateTablesName;
+  }
+
+  /**
+   * @return the tableLastUpdatedTime
+   */
+  public long getTableLastUpdatedTime() {
+    return tableLastUpdatedTime;
+  }
+
+  /**
+   * to get the number of dimension present in the table
+   *
+   * @param tableName
+   * @return number of dimension present the table
+   */
+  public int getNumberOfDimensions(String tableName) {
+    return tableDimensionsMap.get(tableName).size();
+  }
+
+  /**
+   * to get the number of measures present in the table
+   *
+   * @param tableName
+   * @return number of measures present the table
+   */
+  public int getNumberOfMeasures(String tableName) {
+    return tableMeasuresMap.get(tableName).size();
+  }
+
+  /**
+   * to get the all dimension of a table
+   *
+   * @param tableName
+   * @return all dimension of a table
+   */
+  public List<CarbonDimension> getDimensionByTableName(String tableName) {
+    return tableDimensionsMap.get(tableName);
+  }
+
+  /**
+   * to get the all measure of a table
+   *
+   * @param tableName
+   * @return all measure of a table
+   */
+  public List<CarbonMeasure> getMeasureByTableName(String tableName) {
+    return tableMeasuresMap.get(tableName);
+  }
+
+  /**
+   * 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
+   */
+  public List<CarbonColumn> getCreateOrderColumn(String tableName) {
+    return createOrderColumn.get(tableName);
+  }
+
+  /**
+   * to get particular measure from a table
+   *
+   * @param tableName
+   * @param columnName
+   * @return
+   */
+  public CarbonMeasure getMeasureByName(String tableName, String columnName) {
+    List<CarbonMeasure> measureList = tableMeasuresMap.get(tableName);
+    for (CarbonMeasure measure : measureList) {
+      if (measure.getColName().equalsIgnoreCase(columnName)) {
+        return measure;
+      }
+    }
+    return null;
+  }
+
+  /**
+   * to get particular dimension from a table
+   *
+   * @param tableName
+   * @param columnName
+   * @return
+   */
+  public CarbonDimension getDimensionByName(String tableName, String columnName) {
+    CarbonDimension carbonDimension = null;
+    List<CarbonDimension> dimList = tableDimensionsMap.get(tableName);
+    for (CarbonDimension dim : dimList) {
+      if (dim.getColName().equalsIgnoreCase(columnName)) {
+        carbonDimension = dim;
+        break;
+      }
+    }
+    List<CarbonDimension> implicitDimList = tableImplicitDimensionsMap.get(tableName);
+    for (CarbonDimension dim : implicitDimList) {
+      if (dim.getColName().equalsIgnoreCase(columnName)) {
+        carbonDimension = dim;
+        break;
+      }
+    }
+    return carbonDimension;
+  }
+
+  /**
+   * @param tableName
+   * @param columnName
+   * @return
+   */
+  public CarbonColumn getColumnByName(String tableName, String columnName) {
+    List<CarbonColumn> columns = createOrderColumn.get(tableName);
+    Iterator<CarbonColumn> colItr = columns.iterator();
+    while (colItr.hasNext()) {
+      CarbonColumn col = colItr.next();
+      if (col.getColName().equalsIgnoreCase(columnName)) {
+        return col;
+      }
+    }
+    return null;
+  }
+  /**
+   * gets all children dimension for complex type
+   *
+   * @param dimName
+   * @return list of child dimensions
+   */
+  public List<CarbonDimension> getChildren(String dimName) {
+    for (List<CarbonDimension> list : tableDimensionsMap.values()) {
+      List<CarbonDimension> childDims = getChildren(dimName, list);
+      if (childDims != null) {
+        return childDims;
+      }
+    }
+    return null;
+  }
+
+  /**
+   * returns level 2 or more child dimensions
+   *
+   * @param dimName
+   * @param dimensions
+   * @return list of child dimensions
+   */
+  public List<CarbonDimension> getChildren(String dimName, List<CarbonDimension> dimensions) {
+    for (CarbonDimension carbonDimension : dimensions) {
+      if (carbonDimension.getColName().equals(dimName)) {
+        return carbonDimension.getListOfChildDimensions();
+      } else if (null != carbonDimension.getListOfChildDimensions()
+          && carbonDimension.getListOfChildDimensions().size() > 0) {
+        List<CarbonDimension> childDims =
+            getChildren(dimName, carbonDimension.getListOfChildDimensions());
+        if (childDims != null) {
+          return childDims;
+        }
+      }
+    }
+    return null;
+  }
+
+  public BucketingInfo getBucketingInfo(String tableName) {
+    return tableBucketMap.get(tableName);
+  }
+
+  /**
+   * @return absolute table identifier
+   */
+  public AbsoluteTableIdentifier getAbsoluteTableIdentifier() {
+    return absoluteTableIdentifier;
+  }
+
+  /**
+   * @return carbon table identifier
+   */
+  public CarbonTableIdentifier getCarbonTableIdentifier() {
+    return absoluteTableIdentifier.getCarbonTableIdentifier();
+  }
+
+  /**
+   * gets partition count for this table
+   * TODO: to be implemented while supporting partitioning
+   */
+  public int getPartitionCount() {
+    return 1;
+  }
+
+  public int getBlockSizeInMB() {
+    return blockSize;
+  }
+
+  /**
+   * to get the normal dimension or the primitive dimension of the complex type
+   *
+   * @param tableName
+   * @return primitive dimension of a table
+   */
+  public CarbonDimension getPrimitiveDimensionByName(String tableName, String columnName) {
+    List<CarbonDimension> dimList = tablePrimitiveDimensionsMap.get(tableName);
+    for (CarbonDimension dim : dimList) {
+      if (dim.getColName().equalsIgnoreCase(columnName)) {
+        return dim;
+      }
+    }
+    return null;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/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
new file mode 100644
index 0000000..25d6c84
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableInfo.java
@@ -0,0 +1,211 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.carbondata.core.metadata.schema.table;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+
+/**
+ * Store the information about the table.
+ * it stores the fact table as well as aggregate table present in the schema
+ */
+public class TableInfo implements Serializable {
+
+  /**
+   * serialization version
+   */
+  private static final long serialVersionUID = -5034287968314105193L;
+
+  /**
+   * name of the database;
+   */
+  private String databaseName;
+
+  /**
+   * table name to group fact table and aggregate table
+   */
+  private String tableUniqueName;
+
+  /**
+   * fact table information
+   */
+  private TableSchema factTable;
+
+  /**
+   * list of aggregate table
+   */
+  private List<TableSchema> aggregateTableList;
+
+  /**
+   * last updated time to update the table if any changes
+   */
+  private long lastUpdatedTime;
+
+  /**
+   * metadata file path (check if it is really required )
+   */
+  private String metaDataFilepath;
+
+  /**
+   * store location
+   */
+  private String storePath;
+
+  public TableInfo() {
+    aggregateTableList = new ArrayList<TableSchema>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
+  }
+
+  /**
+   * @return the factTable
+   */
+  public TableSchema getFactTable() {
+    return factTable;
+  }
+
+  /**
+   * @param factTable the factTable to set
+   */
+  public void setFactTable(TableSchema factTable) {
+    this.factTable = factTable;
+  }
+
+  /**
+   * @return the aggregateTableList
+   */
+  public List<TableSchema> getAggregateTableList() {
+    return aggregateTableList;
+  }
+
+  /**
+   * @param aggregateTableList the aggregateTableList to set
+   */
+  public void setAggregateTableList(List<TableSchema> aggregateTableList) {
+    this.aggregateTableList = aggregateTableList;
+  }
+
+  /**
+   * @return the databaseName
+   */
+  public String getDatabaseName() {
+    return databaseName;
+  }
+
+  /**
+   * @param databaseName the databaseName to set
+   */
+  public void setDatabaseName(String databaseName) {
+    this.databaseName = databaseName;
+  }
+
+  /**
+   * @return the tableUniqueName
+   */
+  public String getTableUniqueName() {
+    return tableUniqueName;
+  }
+
+  /**
+   * @param tableUniqueName the tableUniqueName to set
+   */
+  public void setTableUniqueName(String tableUniqueName) {
+    this.tableUniqueName = tableUniqueName;
+  }
+
+  /**
+   * @return the lastUpdatedTime
+   */
+  public long getLastUpdatedTime() {
+    return lastUpdatedTime;
+  }
+
+  /**
+   * @param lastUpdatedTime the lastUpdatedTime to set
+   */
+  public void setLastUpdatedTime(long lastUpdatedTime) {
+    this.lastUpdatedTime = lastUpdatedTime;
+  }
+
+  /**
+   * @return
+   */
+  public String getMetaDataFilepath() {
+    return metaDataFilepath;
+  }
+
+  /**
+   * @param metaDataFilepath
+   */
+  public void setMetaDataFilepath(String metaDataFilepath) {
+    this.metaDataFilepath = metaDataFilepath;
+  }
+
+  public String getStorePath() {
+    return storePath;
+  }
+
+  public void setStorePath(String storePath) {
+    this.storePath = storePath;
+  }
+
+  /**
+   * to generate the hash code
+   */
+  @Override public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((databaseName == null) ? 0 : databaseName.hashCode());
+    result = prime * result + ((tableUniqueName == null) ? 0 : tableUniqueName.hashCode());
+    return result;
+  }
+
+  /**
+   * Overridden equals method
+   */
+  @Override public boolean equals(Object obj) {
+    if (this == obj) {
+      return true;
+    }
+    if (obj == null) {
+      return false;
+    }
+    if (!(obj instanceof TableInfo)) {
+      return false;
+    }
+    TableInfo other = (TableInfo) obj;
+    if (databaseName == null) {
+      if (other.databaseName != null) {
+        return false;
+      }
+    } else if (!tableUniqueName.equals(other.tableUniqueName)) {
+      return false;
+    }
+
+    if (tableUniqueName == null) {
+      if (other.tableUniqueName != null) {
+        return false;
+      }
+    } else if (!tableUniqueName.equals(other.tableUniqueName)) {
+      return false;
+    }
+    return true;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ce09aaaf/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableSchema.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableSchema.java b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableSchema.java
new file mode 100644
index 0000000..b350469
--- /dev/null
+++ b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableSchema.java
@@ -0,0 +1,189 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.carbondata.core.metadata.schema.table;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.metadata.schema.BucketingInfo;
+import org.apache.carbondata.core.metadata.schema.SchemaEvolution;
+import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema;
+
+/**
+ * Persisting the table information
+ */
+public class TableSchema implements Serializable {
+
+  /**
+   * serialization version
+   */
+  private static final long serialVersionUID = -1928614587722507026L;
+
+  /**
+   * table id
+   */
+  private String tableId;
+
+  /**
+   * table Name
+   */
+  private String tableName;
+
+  /**
+   * Columns in the table
+   */
+  private List<ColumnSchema> listOfColumns;
+
+  /**
+   * History of schema evolution of this table
+   */
+  private SchemaEvolution schemaEvalution;
+
+  /**
+   * contains all key value pairs for table properties set by user in craete DDL
+   */
+  private Map<String, String> tableProperties;
+
+  /**
+   * Information about bucketing of fields and number of buckets
+   */
+  private BucketingInfo bucketingInfo;
+
+  public TableSchema() {
+    this.listOfColumns = new ArrayList<ColumnSchema>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
+  }
+
+  /**
+   * @return the tableId
+   */
+  public String getTableId() {
+    return tableId;
+  }
+
+  /**
+   * @param tableId the tableId to set
+   */
+  public void setTableId(String tableId) {
+    this.tableId = tableId;
+  }
+
+  /**
+   * @return the listOfColumns
+   */
+  public List<ColumnSchema> getListOfColumns() {
+    return listOfColumns;
+  }
+
+  /**
+   * @param listOfColumns the listOfColumns to set
+   */
+  public void setListOfColumns(List<ColumnSchema> listOfColumns) {
+    this.listOfColumns = listOfColumns;
+  }
+
+  /**
+   * @return the schemaEvalution
+   */
+  public SchemaEvolution getSchemaEvalution() {
+    return schemaEvalution;
+  }
+
+  /**
+   * @param schemaEvalution the schemaEvalution to set
+   */
+  public void setSchemaEvalution(SchemaEvolution schemaEvalution) {
+    this.schemaEvalution = schemaEvalution;
+  }
+
+  /**
+   * @return the tableName
+   */
+  public String getTableName() {
+    return tableName;
+  }
+
+  /**
+   * @param tableName the tableName to set
+   */
+  public void setTableName(String tableName) {
+    this.tableName = tableName;
+  }
+
+  @Override public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((tableId == null) ? 0 : tableId.hashCode());
+    result = prime * result + ((tableName == null) ? 0 : tableName.hashCode());
+    return result;
+  }
+
+  @Override public boolean equals(Object obj) {
+    if (this == obj) {
+      return true;
+    }
+    if (obj == null) {
+      return false;
+    }
+    if (getClass() != obj.getClass()) {
+      return false;
+    }
+    TableSchema other = (TableSchema) obj;
+    if (tableId == null) {
+      if (other.tableId != null) {
+        return false;
+      }
+    } else if (!tableId.equals(other.tableId)) {
+      return false;
+    }
+    if (tableName == null) {
+      if (other.tableName != null) {
+        return false;
+      }
+    } else if (!tableName.equals(other.tableName)) {
+
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * @return
+   */
+  public Map<String, String> getTableProperties() {
+    return tableProperties;
+  }
+
+  /**
+   * @param tableProperties
+   */
+  public void setTableProperties(Map<String, String> tableProperties) {
+    this.tableProperties = tableProperties;
+  }
+
+  public BucketingInfo getBucketingInfo() {
+    return bucketingInfo;
+  }
+
+  public void setBucketingInfo(BucketingInfo bucketingInfo) {
+    this.bucketingInfo = bucketingInfo;
+  }
+}


Mime
View raw message