Skip to content

Commit 27eda51

Browse files
Jacky Lichenliang613
Jacky Li
authored andcommitted
Rename FileMeta to FileFooter (apache#237)
* Rename FileMeta to FileFooter * fix * fix comment
1 parent ab04863 commit 27eda51

25 files changed

+186
-184
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@
1414
target/
1515
.project
1616
.classpath
17+
metastore_db/
18+
derby.log

core/src/main/java/org/carbondata/core/carbon/datastore/BTreeBuilderInfo.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import java.util.List;
2222

23-
import org.carbondata.core.carbon.metadata.leafnode.DataFileMetadata;
23+
import org.carbondata.core.carbon.metadata.leafnode.DataFileFooter;
2424

2525
/**
2626
* below class holds the meta data requires to build the blocks
@@ -31,18 +31,18 @@ public class BTreeBuilderInfo {
3131
* holds all the information about data
3232
* file meta data
3333
*/
34-
private List<DataFileMetadata> dataFileMetadataList;
34+
private List<DataFileFooter> footerList;
3535

3636
/**
3737
* size of the each column value size
3838
* this will be useful for reading
3939
*/
4040
private int[] dimensionColumnValueSize;
4141

42-
public BTreeBuilderInfo(List<DataFileMetadata> dataFileMetadataList,
42+
public BTreeBuilderInfo(List<DataFileFooter> footerList,
4343
int[] dimensionColumnValueSize) {
4444
this.dimensionColumnValueSize = dimensionColumnValueSize;
45-
this.dataFileMetadataList = dataFileMetadataList;
45+
this.footerList = footerList;
4646
}
4747

4848
/**
@@ -53,9 +53,9 @@ public int[] getDimensionColumnValueSize() {
5353
}
5454

5555
/**
56-
* @return the dataFileMetadataList
56+
* @return the footerList
5757
*/
58-
public List<DataFileMetadata> getDataFileMetadataList() {
59-
return dataFileMetadataList;
58+
public List<DataFileFooter> getFooterList() {
59+
return footerList;
6060
}
6161
}

core/src/main/java/org/carbondata/core/carbon/datastore/BlockIndexStore.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import org.carbondata.core.carbon.datastore.block.BlockIndex;
3434
import org.carbondata.core.carbon.datastore.block.TableBlockInfo;
3535
import org.carbondata.core.carbon.datastore.exception.IndexBuilderException;
36-
import org.carbondata.core.carbon.metadata.leafnode.DataFileMetadata;
36+
import org.carbondata.core.carbon.metadata.leafnode.DataFileFooter;
3737
import org.carbondata.core.constants.CarbonCommonConstants;
3838
import org.carbondata.core.util.CarbonCoreLogEvent;
3939
import org.carbondata.core.util.CarbonUtil;
@@ -115,20 +115,20 @@ public List<AbstractIndex> loadAndGetBlocks(List<TableBlockInfo> tableBlocksInfo
115115
tableBlocksMap.put(absoluteTableIdentifier, tableBlockMapTemp);
116116
}
117117
AbstractIndex tableBlock = null;
118-
DataFileMetadata dataFileMatadata = null;
118+
DataFileFooter footer = null;
119119
try {
120120
for (TableBlockInfo blockInfo : tableBlocksInfos) {
121121
// if table block is already loaded then do not load
122122
// that block
123123
tableBlock = tableBlockMapTemp.get(blockInfo);
124124
if (null == tableBlock) {
125125
// getting the data file metadata of the block
126-
dataFileMatadata =
126+
footer =
127127
CarbonUtil.readMetadatFile(blockInfo.getFilePath(), blockInfo.getBlockOffset());
128128
tableBlock = new BlockIndex();
129-
dataFileMatadata.setFilePath(blockInfo.getFilePath());
129+
footer.setFilePath(blockInfo.getFilePath());
130130
// building the block
131-
tableBlock.buildIndex(Arrays.asList(dataFileMatadata));
131+
tableBlock.buildIndex(Arrays.asList(footer));
132132
tableBlockMapTemp.put(blockInfo, tableBlock);
133133
}
134134
loadedBlocksList.add(tableBlock);

core/src/main/java/org/carbondata/core/carbon/datastore/SegmentTaskIndexStore.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import org.carbondata.core.carbon.datastore.block.SegmentTaskIndex;
3434
import org.carbondata.core.carbon.datastore.block.TableBlockInfo;
3535
import org.carbondata.core.carbon.datastore.exception.IndexBuilderException;
36-
import org.carbondata.core.carbon.metadata.leafnode.DataFileMetadata;
36+
import org.carbondata.core.carbon.metadata.leafnode.DataFileFooter;
3737
import org.carbondata.core.constants.CarbonCommonConstants;
3838
import org.carbondata.core.util.CarbonCoreLogEvent;
3939
import org.carbondata.core.util.CarbonUtil;
@@ -118,7 +118,7 @@ public Map<String, AbstractIndex> loadAndGetTaskIdToSegmentsMap(
118118
tableSegmentMap.put(absoluteTableIdentifier, tableSegmentMapTemp);
119119
}
120120
Map<String, AbstractIndex> map = null;
121-
DataFileMetadata dataFileMatadata = null;
121+
DataFileFooter footer = null;
122122
try {
123123
while (iteratorOverSegmentBlocksInfos.hasNext()) {
124124
// segment id to table block mapping
@@ -138,19 +138,19 @@ public Map<String, AbstractIndex> loadAndGetTaskIdToSegmentsMap(
138138
Entry<String, List<TableBlockInfo>> taskIdToBlockInfoIterator = iterator.next();
139139
// all the block of one task id will be loaded together
140140
// so creating a list which will have all the data file metadata to of one task
141-
List<DataFileMetadata> taskDataFileMetadata = new ArrayList<DataFileMetadata>();
141+
List<DataFileFooter> footerList = new ArrayList<DataFileFooter>();
142142

143143
for (TableBlockInfo tableBlockInfo : taskIdToBlockInfoIterator.getValue()) {
144-
dataFileMatadata = CarbonUtil
144+
footer = CarbonUtil
145145
.readMetadatFile(tableBlockInfo.getFilePath(), tableBlockInfo.getBlockOffset());
146-
dataFileMatadata.setFilePath(tableBlockInfo.getFilePath());
147-
dataFileMatadata.setOffset(tableBlockInfo.getBlockOffset());
148-
taskDataFileMetadata.add(dataFileMatadata);
146+
footer.setFilePath(tableBlockInfo.getFilePath());
147+
footer.setOffset(tableBlockInfo.getBlockOffset());
148+
footerList.add(footer);
149149
}
150150
AbstractIndex segment = new SegmentTaskIndex();
151151
// file path of only first block is passed as it all table block info path of
152152
// same task id will be same
153-
segment.buildIndex(taskDataFileMetadata);
153+
segment.buildIndex(footerList);
154154
map.put(taskIdToBlockInfoIterator.getKey(), segment);
155155
}
156156

core/src/main/java/org/carbondata/core/carbon/datastore/block/AbstractIndex.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import java.util.List;
44

55
import org.carbondata.core.carbon.datastore.DataRefNode;
6-
import org.carbondata.core.carbon.metadata.leafnode.DataFileMetadata;
6+
import org.carbondata.core.carbon.metadata.leafnode.DataFileFooter;
77

88
public abstract class AbstractIndex {
99

@@ -48,5 +48,5 @@ public DataRefNode getDataRefNode() {
4848
*
4949
* @param blockInfo block detail
5050
*/
51-
public abstract void buildIndex(List<DataFileMetadata> datFileMetadataList);
51+
public abstract void buildIndex(List<DataFileFooter> footerList);
5252
}

core/src/main/java/org/carbondata/core/carbon/datastore/block/BlockIndex.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.carbondata.core.carbon.datastore.BTreeBuilderInfo;
2424
import org.carbondata.core.carbon.datastore.BtreeBuilder;
2525
import org.carbondata.core.carbon.datastore.impl.btree.BlockletBtreeBuilder;
26-
import org.carbondata.core.carbon.metadata.leafnode.DataFileMetadata;
26+
import org.carbondata.core.carbon.metadata.leafnode.DataFileFooter;
2727

2828
/**
2929
* Class which is responsible for loading the b+ tree block. This class will
@@ -36,18 +36,18 @@ public class BlockIndex extends AbstractIndex {
3636
*
3737
* @param blockInfo block detail
3838
*/
39-
public void buildIndex(List<DataFileMetadata> datFileMetadataList) {
39+
public void buildIndex(List<DataFileFooter> footerList) {
4040
// create a metadata details
4141
// this will be useful in query handling
42-
segmentProperties = new SegmentProperties(datFileMetadataList.get(0).getColumnInTable(),
43-
datFileMetadataList.get(0).getSegmentInfo().getColumnCardinality());
42+
segmentProperties = new SegmentProperties(footerList.get(0).getColumnInTable(),
43+
footerList.get(0).getSegmentInfo().getColumnCardinality());
4444
// create a segment builder info
4545
BTreeBuilderInfo indexBuilderInfo =
46-
new BTreeBuilderInfo(datFileMetadataList, segmentProperties.getDimensionColumnsValueSize());
46+
new BTreeBuilderInfo(footerList, segmentProperties.getDimensionColumnsValueSize());
4747
BtreeBuilder blocksBuilder = new BlockletBtreeBuilder();
4848
// load the metadata
4949
blocksBuilder.build(indexBuilderInfo);
5050
dataRefNode = blocksBuilder.get();
51-
totalNumberOfRows = datFileMetadataList.get(0).getNumberOfRows();
51+
totalNumberOfRows = footerList.get(0).getNumberOfRows();
5252
}
5353
}

core/src/main/java/org/carbondata/core/carbon/datastore/block/SegmentTaskIndex.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.carbondata.core.carbon.datastore.BTreeBuilderInfo;
2424
import org.carbondata.core.carbon.datastore.BtreeBuilder;
2525
import org.carbondata.core.carbon.datastore.impl.btree.BlockBtreeBuilder;
26-
import org.carbondata.core.carbon.metadata.leafnode.DataFileMetadata;
26+
import org.carbondata.core.carbon.metadata.leafnode.DataFileFooter;
2727

2828
/**
2929
* Class which is responsible for loading the b+ tree block. This class will
@@ -36,23 +36,23 @@ public class SegmentTaskIndex extends AbstractIndex {
3636
*
3737
* @param blockInfo block detail
3838
*/
39-
public void buildIndex(List<DataFileMetadata> datFileMetadataList) {
39+
public void buildIndex(List<DataFileFooter> footerList) {
4040
// create a metadata details
4141
// this will be useful in query handling
4242
// all the data file metadata will have common segment properties we
4343
// can use first one to get create the segment properties
44-
segmentProperties = new SegmentProperties(datFileMetadataList.get(0).getColumnInTable(),
45-
datFileMetadataList.get(0).getSegmentInfo().getColumnCardinality());
44+
segmentProperties = new SegmentProperties(footerList.get(0).getColumnInTable(),
45+
footerList.get(0).getSegmentInfo().getColumnCardinality());
4646
// create a segment builder info
4747
// in case of segment create we do not need any file path and each column value size
4848
// as Btree will be build as per min max and start key
49-
BTreeBuilderInfo btreeBuilderInfo = new BTreeBuilderInfo(datFileMetadataList, null);
49+
BTreeBuilderInfo btreeBuilderInfo = new BTreeBuilderInfo(footerList, null);
5050
BtreeBuilder blocksBuilder = new BlockBtreeBuilder();
5151
// load the metadata
5252
blocksBuilder.build(btreeBuilderInfo);
5353
dataRefNode = blocksBuilder.get();
54-
for (DataFileMetadata dataFileMetadata : datFileMetadataList) {
55-
totalNumberOfRows += dataFileMetadata.getNumberOfRows();
54+
for (DataFileFooter footer : footerList) {
55+
totalNumberOfRows += footer.getNumberOfRows();
5656
}
5757
}
5858
}

core/src/main/java/org/carbondata/core/carbon/datastore/impl/btree/BlockBtreeBuilder.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public class BlockBtreeBuilder extends AbstractBtreeBuilder {
7878
List<IndexKey> leafNSKeyList = null;
7979
long nodeNumber = 0;
8080
for (int metadataIndex = 0;
81-
metadataIndex < btreeBuilderInfo.getDataFileMetadataList().size(); metadataIndex++) {
81+
metadataIndex < btreeBuilderInfo.getFooterList().size(); metadataIndex++) {
8282
// creating a leaf node
8383
curNode = new BlockBtreeLeafNode(btreeBuilderInfo, metadataIndex, nodeNumber++);
8484
nLeaf++;
@@ -102,7 +102,7 @@ public class BlockBtreeBuilder extends AbstractBtreeBuilder {
102102
}
103103
if (null != leafNSKeyList) {
104104
leafNSKeyList.add(convertStartKeyToNodeEntry(
105-
btreeBuilderInfo.getDataFileMetadataList().get(metadataIndex).getLeafNodeIndex()
105+
btreeBuilderInfo.getFooterList().get(metadataIndex).getLeafNodeIndex()
106106
.getBtreeIndex().getStartKey()));
107107
}
108108
if (null != currentGroup) {

core/src/main/java/org/carbondata/core/carbon/datastore/impl/btree/BlockBtreeLeafNode.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
package org.carbondata.core.carbon.datastore.impl.btree;
2020

2121
import org.carbondata.core.carbon.datastore.BTreeBuilderInfo;
22-
import org.carbondata.core.carbon.metadata.leafnode.DataFileMetadata;
22+
import org.carbondata.core.carbon.metadata.leafnode.DataFileFooter;
2323
import org.carbondata.core.carbon.metadata.leafnode.indexes.LeafNodeMinMaxIndex;
2424

2525
/**
@@ -42,14 +42,14 @@ public class BlockBtreeLeafNode extends AbstractBtreeLeafNode {
4242
* @param metadataIndex metadata index
4343
*/
4444
public BlockBtreeLeafNode(BTreeBuilderInfo builderInfos, int metadataIndex, long nodeNumber) {
45-
DataFileMetadata dataFileMetadata = builderInfos.getDataFileMetadataList().get(metadataIndex);
46-
LeafNodeMinMaxIndex minMaxIndex = dataFileMetadata.getLeafNodeIndex().getMinMaxIndex();
45+
DataFileFooter footer = builderInfos.getFooterList().get(metadataIndex);
46+
LeafNodeMinMaxIndex minMaxIndex = footer.getLeafNodeIndex().getMinMaxIndex();
4747
maxKeyOfColumns = minMaxIndex.getMaxValues();
4848
minKeyOfColumns = minMaxIndex.getMinValues();
4949
numberOfKeys = 1;
5050
this.nodeNumber = nodeNumber;
51-
this.filePath = dataFileMetadata.getFilePath();
52-
this.offset = dataFileMetadata.getOffset();
51+
this.filePath = footer.getFilePath();
52+
this.offset = footer.getOffset();
5353
}
5454

5555
/**

core/src/main/java/org/carbondata/core/carbon/datastore/impl/btree/BlockletBTreeLeafNode.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -57,29 +57,29 @@ public class BlockletBTreeLeafNode extends AbstractBtreeLeafNode {
5757
public BlockletBTreeLeafNode(BTreeBuilderInfo builderInfos, int leafIndex, long nodeNumber) {
5858
// get a lead node min max
5959
LeafNodeMinMaxIndex minMaxIndex =
60-
builderInfos.getDataFileMetadataList().get(0).getLeafNodeList().get(leafIndex)
60+
builderInfos.getFooterList().get(0).getLeafNodeList().get(leafIndex)
6161
.getLeafNodeIndex().getMinMaxIndex();
6262
// max key of the columns
6363
maxKeyOfColumns = minMaxIndex.getMaxValues();
6464
// min keys of the columns
6565
minKeyOfColumns = minMaxIndex.getMinValues();
6666
// number of keys present in the leaf
67-
numberOfKeys = builderInfos.getDataFileMetadataList().get(0).getLeafNodeList().get(leafIndex)
67+
numberOfKeys = builderInfos.getFooterList().get(0).getLeafNodeList().get(leafIndex)
6868
.getNumberOfRows();
6969
// create a instance of dimension chunk
7070
dimensionChunksReader = new CompressedDimensionChunkFileBasedReader(
71-
builderInfos.getDataFileMetadataList().get(0).getLeafNodeList().get(leafIndex)
71+
builderInfos.getFooterList().get(0).getLeafNodeList().get(leafIndex)
7272
.getDimensionColumnChunk(), builderInfos.getDimensionColumnValueSize(),
73-
builderInfos.getDataFileMetadataList().get(0).getFilePath());
73+
builderInfos.getFooterList().get(0).getFilePath());
7474
// get the value compression model which was used to compress the measure values
7575
ValueCompressionModel valueCompressionModel = CarbonUtil.getValueCompressionModel(
76-
builderInfos.getDataFileMetadataList().get(0).getLeafNodeList().get(leafIndex)
76+
builderInfos.getFooterList().get(0).getLeafNodeList().get(leafIndex)
7777
.getMeasureColumnChunk());
7878
// create a instance of measure column chunk reader
7979
measureColumnChunkReader = new CompressedMeasureChunkFileBasedReader(
80-
builderInfos.getDataFileMetadataList().get(0).getLeafNodeList().get(leafIndex)
80+
builderInfos.getFooterList().get(0).getLeafNodeList().get(leafIndex)
8181
.getMeasureColumnChunk(), valueCompressionModel,
82-
builderInfos.getDataFileMetadataList().get(0).getFilePath());
82+
builderInfos.getFooterList().get(0).getFilePath());
8383
this.nodeNumber = nodeNumber;
8484
}
8585

core/src/main/java/org/carbondata/core/carbon/datastore/impl/btree/BlockletBtreeBuilder.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ public class BlockletBtreeBuilder extends AbstractBtreeBuilder {
5959
List<IndexKey> leafNSKeyList = null;
6060
long nodeNumber = 0;
6161
for (int index = 0;
62-
index < segmentBuilderInfos.getDataFileMetadataList().get(0).getLeafNodeList()
62+
index < segmentBuilderInfos.getFooterList().get(0).getLeafNodeList()
6363
.size(); index++) {
6464
// creating a leaf node
6565
curNode = new BlockletBTreeLeafNode(segmentBuilderInfos, index, nodeNumber++);
6666
totalNumberOfTuple +=
67-
segmentBuilderInfos.getDataFileMetadataList().get(0).getLeafNodeList().get(index)
67+
segmentBuilderInfos.getFooterList().get(0).getLeafNodeList().get(index)
6868
.getNumberOfRows();
6969
nLeaf++;
7070
// setting a next node as its a b+tree
@@ -87,7 +87,7 @@ public class BlockletBtreeBuilder extends AbstractBtreeBuilder {
8787
}
8888
if (null != leafNSKeyList) {
8989
leafNSKeyList.add(convertStartKeyToNodeEntry(
90-
segmentBuilderInfos.getDataFileMetadataList().get(0).getLeafNodeList().get(index)
90+
segmentBuilderInfos.getFooterList().get(0).getLeafNodeList().get(index)
9191
.getLeafNodeIndex().getBtreeIndex().getStartKey()));
9292
}
9393
if (null != currentGroup) {

core/src/main/java/org/carbondata/core/carbon/metadata/leafnode/DataFileMetadata.java core/src/main/java/org/carbondata/core/carbon/metadata/leafnode/DataFileFooter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
/**
2828
* Information of one data file
2929
*/
30-
public class DataFileMetadata implements Serializable {
30+
public class DataFileFooter implements Serializable {
3131

3232
/**
3333
* serialization id

core/src/main/java/org/carbondata/core/reader/CarbonMetaDataReader.java core/src/main/java/org/carbondata/core/reader/CarbonFooterReader.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -21,41 +21,41 @@
2121

2222
import java.io.IOException;
2323

24-
import org.carbondata.format.FileMeta;
24+
import org.carbondata.format.FileFooter;
2525

2626
import org.apache.thrift.TBase;
2727

2828
/**
29-
* Reads the metadata from fact file in org.carbondata.format.FileMeta thrift object
29+
* Reads the metadata from fact file in org.carbondata.format.FileFooter thrift object
3030
*/
31-
public class CarbonMetaDataReader {
31+
public class CarbonFooterReader {
3232

3333
//Fact file path
3434
private String filePath;
3535

3636
//From which offset of file this metadata should be read
3737
private long offset;
3838

39-
public CarbonMetaDataReader(String filePath, long offset) {
39+
public CarbonFooterReader(String filePath, long offset) {
4040

4141
this.filePath = filePath;
4242
this.offset = offset;
4343
}
4444

4545
/**
46-
* It reads the metadata in FileMeta thrift object format.
46+
* It reads the metadata in FileFooter thrift object format.
4747
*
4848
* @return
4949
* @throws IOException
5050
*/
51-
public FileMeta readMetaData() throws IOException {
51+
public FileFooter readFooter() throws IOException {
5252
ThriftReader thriftReader = openThriftReader(filePath);
5353
thriftReader.open();
5454
//Set the offset from where it should read
5555
thriftReader.setReadOffset(offset);
56-
FileMeta fileMeta = (FileMeta) thriftReader.read();
56+
FileFooter footer = (FileFooter) thriftReader.read();
5757
thriftReader.close();
58-
return fileMeta;
58+
return footer;
5959
}
6060

6161
/**
@@ -69,7 +69,7 @@ private ThriftReader openThriftReader(String filePath) throws IOException {
6969

7070
ThriftReader thriftReader = new ThriftReader(filePath, new ThriftReader.TBaseCreator() {
7171
@Override public TBase create() {
72-
return new FileMeta();
72+
return new FileFooter();
7373
}
7474
});
7575
return thriftReader;

0 commit comments

Comments
 (0)