Skip to content

Commit

Permalink
Add encoding type to Thrift interface
Browse files Browse the repository at this point in the history
  • Loading branch information
asuhan committed Jul 13, 2015
1 parent 1bc3168 commit a3e1727
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
23 changes: 23 additions & 0 deletions MapDServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,28 @@ TDatumType::type type_to_thrift(const SQLTypeInfo& type_info) {
CHECK(false);
}

#define ENCODING_CASE(encoding) \
case kENCODING_##encoding: \
return TEncodingType::encoding;

TEncodingType::type encoding_to_thrift(const SQLTypeInfo& type_info) {
switch (type_info.get_compression()) {
ENCODING_CASE(NONE)
ENCODING_CASE(FIXED)
ENCODING_CASE(RL)
ENCODING_CASE(DIFF)
ENCODING_CASE(DICT)
ENCODING_CASE(SPARSE)
default:
CHECK(false);
}
CHECK(false);
}

#undef ENCODING_CASE

} // namespace

#define INVALID_SESSION_ID -1

class MapDHandler : virtual public MapDIf {
Expand Down Expand Up @@ -336,6 +356,7 @@ class MapDHandler : virtual public MapDIf {
}
const auto& target_ti = target->get_expr()->get_type_info();
proj_info.col_type.type = type_to_thrift(target_ti);
proj_info.col_type.encoding = encoding_to_thrift(target_ti);
proj_info.col_type.nullable = !target_ti.get_notnull();
proj_info.col_type.is_array = target_ti.get_type() == kARRAY;
_return.row_set.row_desc.push_back(proj_info);
Expand Down Expand Up @@ -385,6 +406,7 @@ class MapDHandler : virtual public MapDIf {
for (const auto cd : col_descriptors) {
TColumnType col_type;
col_type.col_type.type = type_to_thrift(cd->columnType);
col_type.col_type.encoding = encoding_to_thrift(cd->columnType);
col_type.col_type.nullable = !cd->columnType.get_notnull();
col_type.col_type.is_array = cd->columnType.get_type() == kARRAY;
_return.insert(std::make_pair(cd->columnName, col_type));
Expand Down Expand Up @@ -413,6 +435,7 @@ class MapDHandler : virtual public MapDIf {
TColumnType col_type;
col_type.col_name = cd->columnName;
col_type.col_type.type = type_to_thrift(cd->columnType);
col_type.col_type.encoding = encoding_to_thrift(cd->columnType);
col_type.col_type.nullable = !cd->columnType.get_notnull();
col_type.col_type.is_array = cd->columnType.get_type() == kARRAY;
_return.push_back(col_type);
Expand Down
10 changes: 10 additions & 0 deletions mapd.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ enum TDatumType {
BOOL
}

enum TEncodingType {
NONE,
FIXED,
RL,
DIFF,
DICT,
SPARSE
}

enum TExecuteMode {
HYBRID,
GPU,
Expand All @@ -34,6 +43,7 @@ struct TStringValue {

struct TTypeInfo {
1: TDatumType type,
4: TEncodingType encoding,
2: bool nullable,
3: bool is_array
}
Expand Down

0 comments on commit a3e1727

Please sign in to comment.