use of org.apache.carbondata.core.indexstore.row.IndexRow in project carbondata by apache.
the class BlockIndex method getFileDetails.
private String[] getFileDetails() {
try {
String[] fileDetails = new String[3];
IndexRow unsafeRow = taskSummaryDMStore.getIndexRow(getTaskSummarySchema(), 0);
fileDetails[0] = new String(unsafeRow.getByteArray(SUMMARY_INDEX_PATH), CarbonCommonConstants.DEFAULT_CHARSET);
fileDetails[1] = new String(unsafeRow.getByteArray(SUMMARY_INDEX_FILE_NAME), CarbonCommonConstants.DEFAULT_CHARSET);
fileDetails[2] = new String(unsafeRow.getByteArray(SUMMARY_SEGMENT_ID), CarbonCommonConstants.DEFAULT_CHARSET);
return fileDetails;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.apache.carbondata.core.indexstore.row.IndexRow in project carbondata by apache.
the class BlockIndex method addMinMaxFlagValues.
protected void addMinMaxFlagValues(IndexRow row, CarbonRowSchema carbonRowSchema, boolean[] minMaxFlag, int ordinal) {
CarbonRowSchema[] minMaxFlagSchema = ((CarbonRowSchema.StructCarbonRowSchema) carbonRowSchema).getChildSchemas();
IndexRow minMaxFlagRow = new IndexRowImpl(minMaxFlagSchema);
int flagOrdinal = 0;
// min value adding
for (int i = 0; i < minMaxFlag.length; i++) {
minMaxFlagRow.setBoolean(minMaxFlag[i], flagOrdinal++);
}
row.setRow(minMaxFlagRow, ordinal);
}
use of org.apache.carbondata.core.indexstore.row.IndexRow in project carbondata by apache.
the class BlockIndex method getRowCountForEachBlock.
public Map<String, Long> getRowCountForEachBlock(Segment segment, List<PartitionSpec> partitions, Map<String, Long> blockletToRowCountMap) {
if (memoryDMStore.getRowCount() == 0) {
return new HashMap<>();
}
CarbonRowSchema[] schema = getFileFooterEntrySchema();
int numEntries = memoryDMStore.getRowCount();
for (int i = 0; i < numEntries; i++) {
IndexRow indexRow = memoryDMStore.getIndexRow(schema, i);
String fileName = new String(indexRow.getByteArray(FILE_PATH_INDEX), CarbonCommonConstants.DEFAULT_CHARSET_CLASS) + CarbonTablePath.getCarbonDataExtension();
int rowCount = indexRow.getInt(ROW_COUNT_INDEX);
// prepend segment number with the blocklet file path
String blockletMapKey = segment.getSegmentNo() + "," + fileName;
Long existingCount = blockletToRowCountMap.get(blockletMapKey);
if (null != existingCount) {
blockletToRowCountMap.put(blockletMapKey, (long) rowCount + existingCount);
} else {
blockletToRowCountMap.put(blockletMapKey, (long) rowCount);
}
}
return blockletToRowCountMap;
}
use of org.apache.carbondata.core.indexstore.row.IndexRow in project carbondata by apache.
the class BlockIndex method getMinMaxFlag.
private boolean[] getMinMaxFlag(IndexRow row, int index) {
IndexRow minMaxFlagRow = row.getRow(index);
boolean[] minMaxFlag = new boolean[minMaxFlagRow.getColumnCount()];
for (int i = 0; i < minMaxFlag.length; i++) {
minMaxFlag[i] = minMaxFlagRow.getBoolean(i);
}
return minMaxFlag;
}
use of org.apache.carbondata.core.indexstore.row.IndexRow in project carbondata by apache.
the class SafeMemoryDMStore method convertToUnsafeDMStore.
@Override
public UnsafeMemoryDMStore convertToUnsafeDMStore(CarbonRowSchema[] schema) {
setSchemaDataType(schema);
UnsafeMemoryDMStore unsafeMemoryDMStore = new UnsafeMemoryDMStore();
for (IndexRow indexRow : indexRows) {
indexRow.setSchemas(schema);
unsafeMemoryDMStore.addIndexRow(schema, indexRow);
}
unsafeMemoryDMStore.finishWriting();
return unsafeMemoryDMStore;
}
Aggregations