diff options
author | Varun Gupta <varun.gupta@mariadb.com> | 2020-05-22 21:15:17 +0530 |
---|---|---|
committer | Varun Gupta <varun.gupta@mariadb.com> | 2020-06-18 20:15:06 +0530 |
commit | 4c3cbe23928029288ee1e6fd2fdb957f78a3240f (patch) | |
tree | 607a5725ecb117f0841f42172250c9cecb337bd7 /sql/field.cc | |
parent | 205b0ce6ad21dbafe8def505307b4922398db5b2 (diff) | |
download | mariadb-git-4c3cbe23928029288ee1e6fd2fdb957f78a3240f.tar.gz |
MDEV-22665: Print ranges in the optimizer trace created for non-indexed columns when optimizer_use_condition_selectivity >2
Now the optimizer trace shows the ranges constructed while getting estimates from EITS
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/sql/field.cc b/sql/field.cc index 3f4e1e73029..21145cdf32a 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -11400,6 +11400,46 @@ void Field_blob::print_key_value(String *out, uint32 length) } +/* + @brief Print value of the key part + + @param + out Output string + key value of the key + length Length of field in bytes, + excluding NULL flag and length bytes +*/ + + +void +Field::print_key_part_value(String *out, const uchar* key, uint32 length) +{ + StringBuffer<128> tmp(system_charset_info); + uint null_byte= 0; + if (real_maybe_null()) + { + /* + Byte 0 of key is the null-byte. If set, key is NULL. + Otherwise, print the key value starting immediately after the + null-byte + */ + if (*key) + { + out->append(STRING_WITH_LEN("NULL")); + return; + } + null_byte++; // Skip null byte + } + + set_key_image(key + null_byte, length); + print_key_value(&tmp, length); + if (charset() == &my_charset_bin) + out->append(tmp.ptr(), tmp.length(), tmp.charset()); + else + tmp.print(out, system_charset_info); +} + + void Field::print_key_value_binary(String *out, const uchar* key, uint32 length) { out->append_semi_hex((const char*)key, length, charset()); |