WL#2424: Optimize Item_func_numhybrid()
Affects: Server-7.1
—
Status: Un-Assigned
Currenty we have a switch and one extra call for all 'val_xxx' operations that
uses the Item_func_numhybrid class.
The current code is:
String *Item_func_numhybrid::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
switch (hybrid_type) {
case DECIMAL_RESULT:
{
....
}
case INT_RESULT:
...
}
This should be changed so that we when we calculate 'hybrid_type' set up
virtual functions for calling the needed val_string, val_int, val_decimal and
val_real.
In some cases we can call the 'real' evaluation function directly like in case
of (current code):
double Item_func_numhybrid::val_real()
{
switch (hybrid_type) {
...
case REAL_RESULT:
return real_op();
This will make operations like 1+1 in integer contest or 1.0+1.0 in real
context as fast as possible.
Copyright (c) 2000, 2025, Oracle Corporation and/or its affiliates. All rights reserved.