fix to_char: to_char(Nan) get 0 ==> 'Nan'
This commit is contained in:
@ -984,11 +984,23 @@ int ObExprToCharCommon::process_number_sci_value(
|
|||||||
LOG_WARN("allocate memory for number string failed", K(ret));
|
LOG_WARN("allocate memory for number string failed", K(ret));
|
||||||
} else {
|
} else {
|
||||||
if (is_double) {
|
if (is_double) {
|
||||||
str_len = ob_gcvt_opt(input.get_double(), OB_GCVT_ARG_DOUBLE,
|
double val = input.get_double();
|
||||||
static_cast<int32_t>(alloc_size), buf, NULL, lib::is_oracle_mode(), TRUE);
|
if (isnan(fabs(val)) || fabs(val) == INFINITY){
|
||||||
|
str_len = strlen("Nan");
|
||||||
|
strncpy(buf, "Nan", str_len);
|
||||||
|
} else {
|
||||||
|
str_len = ob_gcvt_opt(val, OB_GCVT_ARG_DOUBLE,
|
||||||
|
static_cast<int32_t>(alloc_size), buf, NULL, lib::is_oracle_mode(), TRUE);
|
||||||
|
}
|
||||||
} else if (is_float) {
|
} else if (is_float) {
|
||||||
str_len = ob_gcvt_opt(input.get_float(), OB_GCVT_ARG_FLOAT,
|
float val = input.get_float();
|
||||||
static_cast<int32_t>(alloc_size), buf, NULL, lib::is_oracle_mode(), TRUE);
|
if (isnan(fabs(val)) || fabs(val) == INFINITY){
|
||||||
|
str_len = strlen("Nan");
|
||||||
|
strncpy(buf, "Nan", str_len);
|
||||||
|
} else {
|
||||||
|
str_len = ob_gcvt_opt(val, OB_GCVT_ARG_FLOAT,
|
||||||
|
static_cast<int32_t>(alloc_size), buf, NULL, lib::is_oracle_mode(), TRUE);
|
||||||
|
}
|
||||||
} else if (is_decimal_int) {
|
} else if (is_decimal_int) {
|
||||||
ObScale in_scale = expr.args_[0]->datum_meta_.scale_;
|
ObScale in_scale = expr.args_[0]->datum_meta_.scale_;
|
||||||
if (OB_FAIL(wide::to_string(input.get_decimal_int(), input.get_int_bytes(),
|
if (OB_FAIL(wide::to_string(input.get_decimal_int(), input.get_int_bytes(),
|
||||||
|
|||||||
Reference in New Issue
Block a user