Skip to content

Commit

Permalink
more prep for supporting strings
Browse files Browse the repository at this point in the history
  • Loading branch information
mapdwei committed Feb 10, 2015
1 parent 23b83b1 commit eb1956b
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 232 deletions.
2 changes: 2 additions & 0 deletions Catalog/ColumnDescriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ struct ColumnDescriptor {
ColumnDescriptor(const int tableId, const int columnId, const std::string &columnName, const SQLTypeInfo columnType, const EncodingType compression, const int comp_param = 0): tableId(tableId), columnId(columnId), columnName(columnName),columnType(columnType),compression(compression),comp_param(comp_param) {
}

inline bool is_varlen() const { return IS_STRING(columnType.type) && compression != kENCODING_DICT; }

int getStorageSize() const {
switch (columnType.type) {
case kBOOLEAN:
Expand Down
9 changes: 0 additions & 9 deletions Catalog/mk_test.sh

This file was deleted.

17 changes: 12 additions & 5 deletions Chunk/Chunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,24 @@

namespace Chunk_NS {
Chunk
Chunk::getChunk(const ColumnDescriptor *cd, DataMgr *data_mgr, const ChunkKey &key, const MemoryLevel memoryLevel, const int deviceId, const size_t numBytes) {
Chunk::getChunk(const ColumnDescriptor *cd, DataMgr *data_mgr, const ChunkKey &key, const MemoryLevel memoryLevel, const int deviceId, const size_t numBytes, const size_t numElems) {
Chunk chunk(cd);
chunk.getChunkBuffer(data_mgr, key, memoryLevel, deviceId, numBytes);
chunk.getChunkBuffer(data_mgr, key, memoryLevel, deviceId, numBytes, numElems);
return chunk;
}

void
Chunk::getChunkBuffer(DataMgr *data_mgr, const ChunkKey &key, const MemoryLevel mem_level, const int device_id, const size_t num_bytes)
Chunk::getChunkBuffer(DataMgr *data_mgr, const ChunkKey &key, const MemoryLevel mem_level, const int device_id, const size_t num_bytes, const size_t num_elems)
{
// @TODO add logic here to handle string case
buffer = data_mgr->getChunkBuffer(key, mem_level, device_id, num_bytes);
if (column_desc->is_varlen()) {
ChunkKey subKey = key;
subKey.push_back(1); // 1 for the main buffer
buffer = data_mgr->getChunkBuffer(subKey, mem_level, device_id, num_bytes);
subKey.pop_back();
subKey.push_back(2); // 2 for the index buffer
index_buf = data_mgr->getChunkBuffer(subKey, mem_level, device_id, (num_elems + 1) * sizeof(int32_t)); // always record n+1 offsets so string length can be calculated
} else
buffer = data_mgr->getChunkBuffer(key, mem_level, device_id, num_bytes);
}

void
Expand Down
4 changes: 2 additions & 2 deletions Chunk/Chunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ namespace Chunk_NS {
ChunkIter begin_iterator(int start_idx, int skip) const;
ChunkMetadata appendData(DataBlockPtr &srcData, const size_t numAppendElems);
void createChunkBuffer(DataMgr *data_mgr, const ChunkKey &key, const MemoryLevel mem_level, const int deviceId = 0);
void getChunkBuffer(DataMgr *data_mgr, const ChunkKey &key, const MemoryLevel mem_level, const int deviceId = 0, const size_t num_bytes = 0);
static Chunk getChunk(const ColumnDescriptor *cd, DataMgr *data_mgr, const ChunkKey &key, const MemoryLevel mem_level, const int deviceId, const size_t num_bytes);
void getChunkBuffer(DataMgr *data_mgr, const ChunkKey &key, const MemoryLevel mem_level, const int deviceId = 0, const size_t num_bytes = 0, const size_t num_elems = 0);
static Chunk getChunk(const ColumnDescriptor *cd, DataMgr *data_mgr, const ChunkKey &key, const MemoryLevel mem_level, const int deviceId, const size_t num_bytes, const size_t num_elems = 0);

// protected:
AbstractBuffer *get_buffer() const { return buffer; }
Expand Down
210 changes: 0 additions & 210 deletions DataMgr/tests/DataMgrTest.cpp

This file was deleted.

2 changes: 0 additions & 2 deletions DataMgr/tests/build_datamgr_test.linux.sh

This file was deleted.

2 changes: 0 additions & 2 deletions DataMgr/tests/build_datamgr_test.mac.sh

This file was deleted.

3 changes: 2 additions & 1 deletion QueryEngine/Execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,8 @@ std::vector<ResultRow> Executor::executeAggScanPlan(
chunk_key,
memory_level,
fragment.deviceIds[static_cast<int>(memory_level)],
chunk_meta_it->second.numBytes);
chunk_meta_it->second.numBytes,
chunk_meta_it->second.numElements);
auto ab = chunk.get_buffer();
CHECK(ab->getMemoryPtr());
auto it = global_to_local_col_ids_.find(col_id);
Expand Down
1 change: 0 additions & 1 deletion Shared/sqltypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ enum SQLTypes {

#define IS_NUMBER(T) (((T) == kINT) || ((T) == kSMALLINT) || ((T) == kDOUBLE) || ((T) == kFLOAT) || ((T) == kBIGINT) || ((T) == kNUMERIC) || ((T) == kDECIMAL))
#define IS_STRING(T) (((T) == kTEXT) || ((T) == kVARCHAR) || ((T) == kCHAR))
#define IS_VARLEN(T) IS_STRING(T)

typedef union {
bool boolval;
Expand Down

0 comments on commit eb1956b

Please sign in to comment.