27#ifndef TEMPTABLE_CELL_CALCULATOR_H
28#define TEMPTABLE_CELL_CALCULATOR_H
58 const Field *mysql_field);
64 const Cell &cell)
const;
74 const Cell &rhs)
const;
77 enum class Mode : uint8_t {
114 : m_mysql_field(mysql_key_part.field),
115 m_cs(field_charset(*m_mysql_field)),
122 if (
m_cs !=
nullptr) {
129 if (use_char_length) {
141 : m_mysql_field(mysql_field),
142 m_cs(field_charset(*m_mysql_field)),
151 if (
m_cs !=
nullptr) {
183 auto data = cell.
data();
188 assert(data_length == 4 || data_length == 8);
226 std::min(
static_cast<size_t>(data_length),
267 if ((lhs_data_length == rhs_data_length) &&
268 ((lhs_data_length == 0) ||
269 (memcmp(lhs.
data(), rhs.
data(), lhs_data_length) == 0))) {
273 auto lhs_data = lhs.
data();
274 auto rhs_data = rhs.
data();
276 size_t lhs_length = 0;
277 size_t rhs_length = 0;
284 lhs_length = lhs_data_length;
285 rhs_length = rhs_data_length;
287 lhs_length = std::min(
288 static_cast<size_t>(lhs_data_length),
290 rhs_length = std::min(
291 static_cast<size_t>(rhs_data_length),
302 m_cs,
reinterpret_cast<const char *
>(lhs_data), lhs_length);
304 m_cs,
reinterpret_cast<const char *
>(rhs_data), rhs_length);
static float float4get(const uchar *M)
Definition: big_endian.h:110
TempTable Cell declaration.
const CHARSET_INFO * charset_for_protocol() const
Definition: field.h:1598
virtual enum ha_base_keytype key_type() const
Definition: field.h:1165
bool is_flag_set(unsigned flag) const
Definition: field.h:752
uint16 length
Definition: key.h:63
uint16 key_part_flag
Definition: key.h:72
Utility to perform calculations for a cell.
Definition: cell_calculator.h:44
static const CHARSET_INFO * field_charset(const Field &field)
Definition: cell_calculator.h:158
uint32_t m_char_length
Length in number of characters.
Definition: cell_calculator.h:102
Mode m_mode
Calculation mode.
Definition: cell_calculator.h:92
static size_t zero_hash()
Convenience function to get the hash value of 0.0.
Definition: cell_calculator.h:314
static const size_t s_zero_hash
This value is to be used for hashing 0 value for approximate types such as float or double.
Definition: cell_calculator.h:107
Cell_calculator()=default
Default constructor used for std::array initialization in Index.
Mode
Definition: cell_calculator.h:77
@ CHARSET_AND_CHAR_LENGTH
size_t hash(const Cell &cell) const
Calculate hash value for a cell.
Definition: cell_calculator.h:177
bool m_is_floating_point
True if the key is of type double or float.
Definition: cell_calculator.h:95
const CHARSET_INFO * m_cs
Charset used by calculator.
Definition: cell_calculator.h:89
const Field * m_mysql_field
Field for which this calculator was created.
Definition: cell_calculator.h:86
bool m_is_space_padded
True if the cell is right-padded with spaces (CHAR column).
Definition: cell_calculator.h:98
int compare(const Cell &lhs, const Cell &rhs) const
Compare two cells.
Definition: cell_calculator.h:245
A cell is the intersection of a row and a column.
Definition: cell.h:42
const unsigned char * data() const
Get a pointer to the user data inside the row.
Definition: cell.h:88
bool is_null() const
Check if this cell is NULL.
Definition: cell.h:84
uint32_t data_length() const
Get the length of the user data.
Definition: cell.h:86
#define ENUM_FLAG
field is an enum
Definition: mysql_com.h:164
#define SET_FLAG
field is a set
Definition: mysql_com.h:167
int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length)
Compare key in record buffer to a given key.
Definition: key.cc:454
A better implementation of the UNIX ctype(3) library.
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_bin
Definition: ctype-bin.cc:509
size_t my_charpos(const CHARSET_INFO *cs, const char *beg, const char *end, size_t pos)
Definition: m_ctype.h:658
@ NO_PAD
Definition: m_ctype.h:244
@ HA_KEYTYPE_VARBINARY2
Definition: my_base.h:461
@ HA_KEYTYPE_VARTEXT2
Definition: my_base.h:460
@ HA_KEYTYPE_FLOAT
Definition: my_base.h:446
@ HA_KEYTYPE_DOUBLE
Definition: my_base.h:447
@ HA_KEYTYPE_VARTEXT1
Definition: my_base.h:457
@ HA_KEYTYPE_VARBINARY1
Definition: my_base.h:458
@ HA_KEYTYPE_TEXT
Definition: my_base.h:442
#define HA_PART_KEY_SEG
Definition: my_base.h:563
void float8store(char *V, double M)
Definition: my_byteorder.h:210
double float8get(const char *M)
Definition: my_byteorder.h:206
#define DBUG_EXECUTE_IF(keyword, a1)
Definition: my_dbug.h:171
void my_abort()
Calls our own implementation of abort, if specified, or std's abort().
Definition: my_init.cc:261
unsigned char uchar
Definition: my_inttypes.h:52
uint64_t uint64
Definition: my_inttypes.h:69
uint32 murmur3_32(const uchar *key, size_t len, uint32 seed)
Compute 32-bit version of MurmurHash3 hash for the key.
Definition: my_murmur3.cc:86
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
int key_type
Definition: method.h:38
Definition: allocator.h:45
Definition: m_ctype.h:423
unsigned mbmaxlen
Definition: m_ctype.h:447
MY_COLLATION_HANDLER * coll
Definition: m_ctype.h:456
MY_CHARSET_HANDLER * cset
Definition: m_ctype.h:455
enum Pad_attribute pad_attribute
If this collation is PAD_SPACE, it collates as if all inputs were padded with a given number of space...
Definition: m_ctype.h:465
size_t(* lengthsp)(const CHARSET_INFO *, const char *ptr, size_t length)
Given a pointer and a length in bytes, returns a new length in bytes where all trailing space charact...
Definition: m_ctype.h:374
void(* hash_sort)(const CHARSET_INFO *cs, const uint8_t *key, size_t len, uint64_t *nr1, uint64_t *nr2)
Compute a sort hash for the given key.
Definition: m_ctype.h:328
int(* strnncollsp)(const CHARSET_INFO *, const uint8_t *, size_t, const uint8_t *, size_t)
Compare the two strings under the pad rules given by the collation.
Definition: m_ctype.h:262