Skip to content

Commit ed9fec0

Browse files
committed
MDEV-35177 Unexpected ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, diagnostics area assertion failures upon EITS collection with vector type
1 parent db10e5c commit ed9fec0

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed

mysql-test/main/vector2.result

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,16 @@ test.t1 analyze status Engine-independent statistics collected
170170
test.t1 analyze status OK
171171
drop table t1;
172172
#
173+
# MDEV-35177 Unexpected ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, diagnostics area assertion failures upon EITS collection with vector type
174+
#
175+
create table t (pk int primary key, v vector(1) not null);
176+
insert into t values (1,vec_fromtext('[-0.196]')),(2,vec_fromtext('[0.709]'));
177+
analyze table t persistent for all;
178+
Table Op Msg_type Msg_text
179+
test.t analyze status Engine-independent statistics collected
180+
test.t analyze status OK
181+
drop table t;
182+
#
173183
# MDEV-35147 Inconsistent NULL handling in vector type
174184
#
175185
create table t1 (a vector(1));

mysql-test/main/vector2.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ insert into t1 select vec_fromtext(concat('[',group_concat(1),']')) from seq_1_t
133133
analyze table t1 persistent for all;
134134
drop table t1;
135135

136+
--echo #
137+
--echo # MDEV-35177 Unexpected ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, diagnostics area assertion failures upon EITS collection with vector type
138+
--echo #
139+
create table t (pk int primary key, v vector(1) not null);
140+
insert into t values (1,vec_fromtext('[-0.196]')),(2,vec_fromtext('[0.709]'));
141+
analyze table t persistent for all;
142+
drop table t;
143+
136144
--echo #
137145
--echo # MDEV-35147 Inconsistent NULL handling in vector type
138146
--echo #

sql/sql_type_vector.cc

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -303,20 +303,23 @@ int Field_vector::store_decimal(const my_decimal *nr)
303303

304304
int Field_vector::store(const char *from, size_t length, CHARSET_INFO *cs)
305305
{
306-
if (cs != &my_charset_bin) // XXX todo
307-
return report_wrong_value(ErrConvString(from, length, cs));
308-
309-
if (length != field_length)
310-
return report_wrong_value(ErrConvString(from, length, cs));
311-
312-
float abs2= 0.0f;
313-
for (const char *v= from, *end= from+length; v < end; v+= sizeof(float))
306+
if (table->in_use->count_cuted_fields != CHECK_FIELD_IGNORE)
314307
{
315-
float val= get_float(v);
316-
abs2+= val*val;
308+
if (cs != &my_charset_bin) // XXX todo
309+
return report_wrong_value(ErrConvString(from, length, cs));
310+
311+
if (length != field_length)
312+
return report_wrong_value(ErrConvString(from, length, cs));
313+
314+
float abs2= 0.0f;
315+
for (const char *v= from, *end= from+length; v < end; v+= sizeof(float))
316+
{
317+
float val= get_float(v);
318+
abs2+= val*val;
319+
}
320+
if (!std::isfinite(abs2))
321+
return report_wrong_value(ErrConvString(from, length, cs));
317322
}
318-
if (!std::isfinite(abs2))
319-
return report_wrong_value(ErrConvString(from, length, cs));
320323

321324
return Field_varstring::store(from, length, cs);
322325
}

0 commit comments

Comments
 (0)