diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2017-09-07 15:49:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-07 15:49:11 +0300 |
commit | 904b69cd9ed15b0d605b9923439e9a66b5057084 (patch) | |
tree | 006b4d328b739cf2d3afbfa4fe7f48496c14b191 /sql/partition_element.h | |
parent | a734c2f0fb44b777866d8b0bc9ec46a08e4e6505 (diff) | |
download | mariadb-git-904b69cd9ed15b0d605b9923439e9a66b5057084.tar.gz |
SQL: partitioning misc fixes [closes #242]
* cleanup: *never* use assert(A && B)
* vers_setup_1() revisited
* vers_setup_2() renamed
* partition_element::type removed
* Copy ctor instead of memcpy()
* Handle return value from check_range_constants()
* Malloc error fix
* error, style, misc fixes
Diffstat (limited to 'sql/partition_element.h')
-rw-r--r-- | sql/partition_element.h | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/sql/partition_element.h b/sql/partition_element.h index 723d2f21a46..b8b716e5273 100644 --- a/sql/partition_element.h +++ b/sql/partition_element.h @@ -151,6 +151,13 @@ enum stat_trx_field class partition_element :public Sql_alloc { public: + enum elem_type + { + CONVENTIONAL= 0, + AS_OF_NOW, + VERSIONING + }; + List<partition_element> subpartitions; List<part_elem_value> list_val_list; ha_rows part_max_rows; @@ -172,14 +179,18 @@ public: uint32 id; bool empty; - enum elem_type + // TODO: subclass partition_element by partitioning type to avoid such semantic + // mixup + elem_type type() { - CONVENTIONAL= 0, - AS_OF_NOW, - VERSIONING - }; + return (elem_type)(signed_flag << 1 | max_value); + } - elem_type type; + void type(elem_type val) + { + max_value= val & 1; + signed_flag= val & 2; + } partition_element() : part_max_rows(0), part_min_rows(0), range_value(0), @@ -190,8 +201,7 @@ public: nodegroup_id(UNDEF_NODEGROUP), has_null_value(FALSE), signed_flag(FALSE), max_value(FALSE), id(UINT32_MAX), - empty(true), - type(CONVENTIONAL) + empty(true) {} partition_element(partition_element *part_elem) : part_max_rows(part_elem->part_max_rows), @@ -207,17 +217,16 @@ public: nodegroup_id(part_elem->nodegroup_id), has_null_value(FALSE), id(part_elem->id), - empty(part_elem->empty), - type(part_elem->type) + empty(part_elem->empty) {} ~partition_element() {} part_column_list_val& get_col_val(uint idx) { - DBUG_ASSERT(type != CONVENTIONAL); - DBUG_ASSERT(list_val_list.elements == 1); - part_elem_value *ev= static_cast<part_elem_value*>(list_val_list.first_node()->info); - DBUG_ASSERT(ev && ev->col_val_array); + DBUG_ASSERT(type() == CONVENTIONAL || list_val_list.elements == 1); + part_elem_value *ev= list_val_list.head(); + DBUG_ASSERT(ev); + DBUG_ASSERT(ev->col_val_array); return ev->col_val_array[idx]; } }; |