bugfix json_object with year data core dump
This commit is contained in:
@ -759,8 +759,7 @@ int ObJsonExprHelper::transform_scalar_2jsonBase(const T &datum,
|
|||||||
case ObUSmallIntType:
|
case ObUSmallIntType:
|
||||||
case ObUMediumIntType:
|
case ObUMediumIntType:
|
||||||
case ObUInt32Type:
|
case ObUInt32Type:
|
||||||
case ObUInt64Type:
|
case ObUInt64Type: {
|
||||||
case ObYearType: {
|
|
||||||
buf = allocator->alloc(sizeof(ObJsonUint));
|
buf = allocator->alloc(sizeof(ObJsonUint));
|
||||||
if (OB_ISNULL(buf)) {
|
if (OB_ISNULL(buf)) {
|
||||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||||
@ -770,6 +769,19 @@ int ObJsonExprHelper::transform_scalar_2jsonBase(const T &datum,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ObYearType: {
|
||||||
|
buf = allocator->alloc(sizeof(ObJsonInt));
|
||||||
|
int64_t value = 0;
|
||||||
|
if (OB_FAIL(ObTimeConverter::year_to_int(datum.get_year(), value))) {
|
||||||
|
LOG_WARN("fail to get year data", K(ret));
|
||||||
|
} else if (OB_ISNULL(buf)) {
|
||||||
|
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||||
|
LOG_WARN("buf allocate failed", K(ret), K(type));
|
||||||
|
} else {
|
||||||
|
json_node = (ObJsonInt*)new(buf)ObJsonInt(value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ObDateTimeType:
|
case ObDateTimeType:
|
||||||
case ObTimestampType:
|
case ObTimestampType:
|
||||||
case ObTimestampNanoType:
|
case ObTimestampNanoType:
|
||||||
|
|||||||
Reference in New Issue
Block a user