summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2020-03-28 12:31:22 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2020-12-04 23:38:09 +0530
commit202393086e4da6c6864778dcb87339f159ea48f6 (patch)
tree203cb33f02b64b59de11f86c56ba423f352ba0d2 /sql/field.h
parente9f33b7760539e2ba60fb236fab8eaf0ce53ca4a (diff)
downloadmariadb-git-bb-10.6-mdev21829.tar.gz
MDEV-21829: Use packed sort keys in Unique objectsbb-10.6-mdev21829
The task deals with packing the values stored in the Unique tree for each record. The changes brought by this feature is: 1) Unique tree can have dynamic length keys 2) Format of keys looks like <key_length> <packed_value1> <packed_value2> ....... <packed_valueN> Unique class is currently used in 1) agg_func(DISTINCT col) Here most aggregate functions like SUM, AVG accept only fixed size arguments so it is not beneficial to use packing for these. Packing is done for COUNT and GROUP_CONCAT (or JSON_ARRAYAGG) aggregate function as these are meaningful 2) index-merge stores row-ids index merge stores row-ids which are of fixed size, so packing is not required 3) Engine Independent Table statistics Packing is done here for variable length data types This task is an extension to MDEV-21580.
Diffstat (limited to 'sql/field.h')
-rw-r--r--sql/field.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/sql/field.h b/sql/field.h
index dfc02149f9d..351dd9620a0 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1110,6 +1110,11 @@ public:
*/
virtual uint32 data_length() { return pack_length(); }
virtual uint32 sort_length() const { return pack_length(); }
+ /*
+ returns the sort_length for a field without the suffix length bytes
+ for field with binary charset.
+ */
+ virtual uint32 sort_length_without_suffix() const { return pack_length(); }
/*
sort_suffix_length() return the length bytes needed to store the length
@@ -1470,6 +1475,9 @@ public:
virtual uint make_packed_sort_key_part(uchar *buff,
const SORT_FIELD_ATTR *sort_field);
+ virtual uint make_packed_key_part(uchar *buff,
+ const SORT_FIELD_ATTR *sort_field);
+
virtual void make_send_field(Send_field *);
/*
@@ -2222,6 +2230,8 @@ public:
bool is_packable() const override { return true; }
uint make_packed_sort_key_part(uchar *buff,
const SORT_FIELD_ATTR *sort_field)override;
+ uint make_packed_key_part(uchar *buff,
+ const SORT_FIELD_ATTR *sort_field) override;
uchar* pack_sort_string(uchar *to, const SORT_FIELD_ATTR *sort_field);
};
@@ -4148,6 +4158,10 @@ public:
{
return (uint32) field_length + sort_suffix_length();
}
+ uint32 sort_length_without_suffix() const override
+ {
+ return (uint32) field_length;
+ }
virtual uint32 sort_suffix_length() const override
{
return (field_charset() == &my_charset_bin ? length_bytes : 0);
@@ -4496,6 +4510,10 @@ public:
{ return (uint32) (packlength); }
uint row_pack_length() const override { return pack_length_no_ptr(); }
uint32 sort_length() const override;
+ uint32 sort_length_without_suffix() const override
+ {
+ return (uint32)field_length;
+ }
uint32 sort_suffix_length() const override;
uint32 value_length() override { return get_length(); }
virtual uint32 max_data_length() const override