Fix dayname func when deduce type without setting length
This commit is contained in:
@ -140,6 +140,8 @@ extern const int64_t USECS_PER_MIN;
|
|||||||
#define DATETIME_MAX_LENGTH 26
|
#define DATETIME_MAX_LENGTH 26
|
||||||
#define TIME_MIN_LENGTH 10
|
#define TIME_MIN_LENGTH 10
|
||||||
#define DATE_MIN_LENGTH 10
|
#define DATE_MIN_LENGTH 10
|
||||||
|
#define DAYNAME_MAX_LENGTH 9 //Wednesday is longest
|
||||||
|
#define MONTHNAME_MAX_LENGTH 9 //September is longest
|
||||||
//max timestamp最大值为253402272000 12位
|
//max timestamp最大值为253402272000 12位
|
||||||
#define TIMESTAMP_VALUE_LENGTH 12
|
#define TIMESTAMP_VALUE_LENGTH 12
|
||||||
#define SEC_TO_USEC(secs) ((secs) * USECS_PER_SEC)
|
#define SEC_TO_USEC(secs) ((secs) * USECS_PER_SEC)
|
||||||
|
|||||||
@ -635,11 +635,14 @@ int ObExprDayName::calc_result_type1(ObExprResType &type,
|
|||||||
{
|
{
|
||||||
ObCollationType cs_type = type_ctx.get_coll_type();
|
ObCollationType cs_type = type_ctx.get_coll_type();
|
||||||
type.set_varchar();
|
type.set_varchar();
|
||||||
|
type.set_full_length(DAYNAME_MAX_LENGTH, type1.get_length_semantics());
|
||||||
type.set_collation_type(cs_type);
|
type.set_collation_type(cs_type);
|
||||||
type.set_collation_level(CS_LEVEL_IMPLICIT);
|
type.set_collation_level(CS_LEVEL_IMPLICIT);
|
||||||
common::ObObjTypeClass tc1 = ob_obj_type_class(type1.get_type());
|
common::ObObjTypeClass tc1 = ob_obj_type_class(type1.get_type());
|
||||||
if (ob_is_enumset_tc(type1.get_type())) {
|
if (ob_is_enumset_tc(type1.get_type())) {
|
||||||
type1.set_calc_type(common::ObVarcharType);
|
type1.set_calc_type(common::ObVarcharType);
|
||||||
|
type1.set_collation_type(cs_type);
|
||||||
|
type1.set_collation_level(CS_LEVEL_IMPLICIT);
|
||||||
} else if ((common::ObFloatTC == tc1) || (common::ObDoubleTC == tc1)) {
|
} else if ((common::ObFloatTC == tc1) || (common::ObDoubleTC == tc1)) {
|
||||||
type1.set_calc_type(common::ObIntType);
|
type1.set_calc_type(common::ObIntType);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -335,11 +335,12 @@ int ObExprMonthName::calc_result_type1(ObExprResType &type,
|
|||||||
type.set_varchar();
|
type.set_varchar();
|
||||||
type.set_collation_type(cs_type);
|
type.set_collation_type(cs_type);
|
||||||
type.set_collation_level(CS_LEVEL_IMPLICIT);
|
type.set_collation_level(CS_LEVEL_IMPLICIT);
|
||||||
|
type.set_full_length(MONTHNAME_MAX_LENGTH, type1.get_length_semantics());
|
||||||
common::ObObjTypeClass tc1 = ob_obj_type_class(type1.get_type());
|
common::ObObjTypeClass tc1 = ob_obj_type_class(type1.get_type());
|
||||||
if (common::ObEnumSetTC == tc1) {
|
if (common::ObEnumSetTC == tc1) {
|
||||||
type1.set_calc_type(common::ObVarcharType);
|
type1.set_calc_type(common::ObVarcharType);
|
||||||
type1.set_calc_collation_type(cs_type);
|
type1.set_collation_type(cs_type);
|
||||||
|
type1.set_collation_level(CS_LEVEL_IMPLICIT);
|
||||||
} else if ((common::ObFloatTC == tc1) || (common::ObDoubleTC == tc1)) {
|
} else if ((common::ObFloatTC == tc1) || (common::ObDoubleTC == tc1)) {
|
||||||
type1.set_calc_type(common::ObIntType);
|
type1.set_calc_type(common::ObIntType);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user