Commit 16366564 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-19724 Add Field::tmp_engine_column_type()

parent b6851095
......@@ -7529,6 +7529,12 @@ Field *Field_string::make_new_field(MEM_ROOT *root, TABLE *new_table,
}
en_fieldtype Field_string::tmp_engine_column_type(bool use_packed_rows) const
{
return field_length >= MIN_STRING_LENGTH_TO_PACK_ROWS ? FIELD_SKIP_ENDSPACE :
FIELD_NORMAL;
}
/****************************************************************************
VARCHAR type
Data in field->ptr is stored as:
......
......@@ -1125,6 +1125,10 @@ class Field: public Value_source
*/
return type();
}
virtual en_fieldtype tmp_engine_column_type(bool use_packed_rows) const
{
return FIELD_NORMAL;
}
/*
Conversion type for from the source to the current field.
*/
......@@ -3647,6 +3651,7 @@ class Field_string :public Field_longstr {
}
enum ha_base_keytype key_type() const
{ return binary() ? HA_KEYTYPE_BINARY : HA_KEYTYPE_TEXT; }
en_fieldtype tmp_engine_column_type(bool use_packed_rows) const;
bool zero_pack() const { return 0; }
Copy_func *get_copy_func(const Field *from) const;
int reset(void)
......@@ -3747,6 +3752,10 @@ class Field_varstring :public Field_longstr {
}
const Type_handler *type_handler() const { return &type_handler_varchar; }
en_fieldtype tmp_engine_column_type(bool use_packed_rows) const
{
return FIELD_VARCHAR;
}
enum ha_base_keytype key_type() const;
uint16 key_part_flag() const { return HA_VAR_LENGTH_PART; }
uint16 key_part_length_bytes() const { return HA_KEY_BLOB_LENGTH; }
......@@ -3967,6 +3976,10 @@ class Field_blob :public Field_longstr {
{ return binary() ? HA_KEYTYPE_VARBINARY2 : HA_KEYTYPE_VARTEXT2; }
uint16 key_part_flag() const { return HA_BLOB_PART; }
uint16 key_part_length_bytes() const { return HA_KEY_BLOB_LENGTH; }
en_fieldtype tmp_engine_column_type(bool use_packed_rows) const
{
return FIELD_BLOB;
}
Type_std_attributes type_std_attributes() const
{
return Type_std_attributes(Field_blob::max_display_length(), decimals(),
......@@ -4632,6 +4645,11 @@ class Field_row: public Field_null
m_table(NULL)
{}
~Field_row();
en_fieldtype tmp_engine_column_type(bool use_packed_rows) const
{
DBUG_ASSERT(0);
return Field::tmp_engine_column_type(use_packed_rows);
}
enum_conv_type rpl_conv_type_from(const Conv_source &source,
const Relay_log_info *rli,
const Conv_param &param) const
......
......@@ -4483,15 +4483,7 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
/* Make entry for create table */
recinfo->length=length;
if (field->flags & BLOB_FLAG)
recinfo->type= FIELD_BLOB;
else if (use_packed_rows &&
field->real_type() == MYSQL_TYPE_STRING &&
length >= MIN_STRING_LENGTH_TO_PACK_ROWS)
recinfo->type=FIELD_SKIP_ENDSPACE;
else
recinfo->type=FIELD_NORMAL;
recinfo->type= field->tmp_engine_column_type(use_packed_rows);
field->set_table_name(&table->alias);
}
......
......@@ -18378,17 +18378,7 @@ bool Create_tmp_table::finalize(THD *thd,
/* Make entry for create table */
recinfo->length=length;
if (field->flags & BLOB_FLAG)
recinfo->type= FIELD_BLOB;
else if (use_packed_rows &&
field->real_type() == MYSQL_TYPE_STRING &&
length >= MIN_STRING_LENGTH_TO_PACK_ROWS)
recinfo->type= FIELD_SKIP_ENDSPACE;
else if (field->real_type() == MYSQL_TYPE_VARCHAR)
recinfo->type= FIELD_VARCHAR;
else
recinfo->type= FIELD_NORMAL;
recinfo->type= field->tmp_engine_column_type(use_packed_rows);
if (!--m_hidden_field_count)
m_null_count= (m_null_count + 7) & ~7; // move to next byte
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment