You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
MCOL-4247 TYpecast causes wrong virtual function
This commit is contained in:
@ -770,22 +770,28 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool h
|
|||||||
if (dl == std::numeric_limits<double>::infinity())
|
if (dl == std::numeric_limits<double>::infinity())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Field_double* f2 = (Field_double*)*f;
|
if ((*f)->type() == MYSQL_TYPE_NEWDECIMAL)
|
||||||
// bug 3483, reserve enough space for the longest double value
|
{
|
||||||
// -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and
|
char buf[310];
|
||||||
// 2.2250738585072014E-308 to 1.7976931348623157E+308.
|
// reserve enough space for the longest double value
|
||||||
(*f)->field_length = 310;
|
// -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and
|
||||||
|
// 2.2250738585072014E-308 to 1.7976931348623157E+308.
|
||||||
// The server converts dl=-0 to dl=0 in f2->store().
|
snprintf(buf, 310, "%.18g", dl);
|
||||||
// This happens in the call to truncate_double().
|
(*f)->store(buf, strlen(buf), (*f)->charset());
|
||||||
// This is an unexpected behaviour, so we directly store the
|
}
|
||||||
// double value using the lower level float8store() function.
|
|
||||||
// TODO Remove this when f2->store() handles this properly.
|
|
||||||
if (dl == 0)
|
|
||||||
float8store(f2->ptr,dl);
|
|
||||||
else
|
else
|
||||||
f2->store(dl);
|
{
|
||||||
|
// The server converts dl=-0 to dl=0 in f2->store().
|
||||||
|
// This happens in the call to truncate_double().
|
||||||
|
// This is an unexpected behaviour, so we directly store the
|
||||||
|
// double value using the lower level float8store() function.
|
||||||
|
// TODO Remove this when f2->store() handles this properly.
|
||||||
|
(*f)->field_length = 310;
|
||||||
|
if (dl == 0)
|
||||||
|
float8store((*f)->ptr,dl);
|
||||||
|
else
|
||||||
|
(*f)->store(dl);
|
||||||
|
}
|
||||||
if ((*f)->null_ptr)
|
if ((*f)->null_ptr)
|
||||||
*(*f)->null_ptr &= ~(*f)->null_bit;
|
*(*f)->null_ptr &= ~(*f)->null_bit;
|
||||||
|
|
||||||
@ -800,39 +806,22 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool h
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch((*f)->type())
|
if ((*f)->type() == MYSQL_TYPE_NEWDECIMAL)
|
||||||
{
|
{
|
||||||
case MYSQL_TYPE_NEWDECIMAL:
|
char buf[310];
|
||||||
{
|
snprintf(buf, 310, "%.20Lg", dl);
|
||||||
char buf[310];
|
(*f)->store(buf, strlen(buf), (*f)->charset());
|
||||||
Field_new_decimal* f2 = (Field_new_decimal*)*f;
|
|
||||||
snprintf(buf, 310, "%.20Lg", dl);
|
|
||||||
f2->store(buf, strlen(buf), f2->charset());
|
|
||||||
if ((*f)->null_ptr)
|
|
||||||
*(*f)->null_ptr &= ~(*f)->null_bit;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MYSQL_TYPE_DOUBLE:
|
|
||||||
{
|
|
||||||
Field_double* f2 = (Field_double*)*f;
|
|
||||||
|
|
||||||
// bug 3483, reserve enough space for the longest double value
|
|
||||||
// -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and
|
|
||||||
// 2.2250738585072014E-308 to 1.7976931348623157E+308.
|
|
||||||
(*f)->field_length = 310;
|
|
||||||
|
|
||||||
f2->store(static_cast<double>(dl));
|
|
||||||
if ((*f)->null_ptr)
|
|
||||||
*(*f)->null_ptr &= ~(*f)->null_bit;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
continue; // Shouldn't happen. Functions should not return long double to other than double or decimal return type.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
break;
|
{
|
||||||
|
// reserve enough space for the longest double value
|
||||||
|
// -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and
|
||||||
|
// 2.2250738585072014E-308 to 1.7976931348623157E+308.
|
||||||
|
(*f)->field_length = 310;
|
||||||
|
(*f)->store(static_cast<double>(dl));
|
||||||
|
}
|
||||||
|
if ((*f)->null_ptr)
|
||||||
|
*(*f)->null_ptr &= ~(*f)->null_bit;
|
||||||
}
|
}
|
||||||
|
|
||||||
case CalpontSystemCatalog::DECIMAL:
|
case CalpontSystemCatalog::DECIMAL:
|
||||||
|
Reference in New Issue
Block a user