fix: json type object support empty string key

This commit is contained in:
obdev
2022-10-21 03:32:23 +00:00
committed by wangzelin.wzl
parent 82519cc587
commit 4ad6e00ec3
5 changed files with 30 additions and 28 deletions

View File

@ -1155,7 +1155,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
case ObMediumIntType:
case ObInt32Type:
case ObIntType: {
int64_t val;
int64_t val = 0;
ret = cast_to_int(j_base, dst_type, val);
if (!try_set_error_val<ObObj>(res, ret, error_type, error_val)) {
res.set_int(dst_type, val);
@ -1167,7 +1167,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
case ObUMediumIntType:
case ObUInt32Type:
case ObUInt64Type: {
uint64_t val;
uint64_t val = 0;
ret = cast_to_uint(j_base, dst_type, val);
if (!try_set_error_val<ObObj>(res, ret, error_type, error_val)) {
res.set_uint(dst_type, val);
@ -1175,7 +1175,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break;
}
case ObDateTimeType: {
int64_t val;
int64_t val = 0;
ret = cast_to_datetime(j_base, accuracy, val);
if (ret == OB_ERR_NULL_VALUE) {
res.set_null();
@ -1194,7 +1194,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break;
}
case ObDateType: {
int32_t val;
int32_t val = 0;
ret = cast_to_date(j_base, val);
if (!try_set_error_val<ObObj>(res, ret, error_type, error_val)) {
res.set_date(val);
@ -1202,7 +1202,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break;
}
case ObTimeType: {
int64_t val;
int64_t val = 0;
ret = cast_to_time(j_base, accuracy, val);
if (!try_set_error_val<ObObj>(res, ret, error_type, error_val)) {
res.set_time(val);
@ -1210,7 +1210,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break;
}
case ObYearType: {
uint8_t val;
uint8_t val = 0;
ret = cast_to_year(j_base, val);
if (!try_set_error_val<ObObj>(res, ret, error_type, error_val)) {
res.set_year(val);
@ -1219,7 +1219,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
}
case ObFloatType:
case ObUFloatType: {
float out_val;
float out_val = 0;
ret = cast_to_float(j_base, dst_type, out_val);
if (!try_set_error_val<ObObj>(res, ret, error_type, error_val)) {
res.set_float(dst_type, out_val);
@ -1228,7 +1228,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
}
case ObDoubleType:
case ObUDoubleType: {
double out_val;
double out_val = 0;
ret = cast_to_double(j_base, dst_type, out_val);
if (!try_set_error_val<ObObj>(res, ret, error_type, error_val)) {
res.set_double(dst_type, out_val);
@ -1262,7 +1262,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break;
}
case ObBitType: {
uint64_t out_val;
uint64_t out_val = 0;
ret = cast_to_bit(j_base, out_val);
if (!try_set_error_val<ObObj>(res, ret, error_type, error_val)) {
res.set_bit(out_val);
@ -1325,7 +1325,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
case ObMediumIntType:
case ObInt32Type:
case ObIntType: {
int64_t val;
int64_t val = 0;
ret = cast_to_int(j_base, dst_type, val);
if (!try_set_error_val<ObDatum>(res, ret, error_type, error_val)) {
res.set_int(val);
@ -1337,7 +1337,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
case ObUMediumIntType:
case ObUInt32Type:
case ObUInt64Type: {
uint64_t val;
uint64_t val = 0;
ret = cast_to_uint(j_base, dst_type, val);
if (!try_set_error_val<ObDatum>(res, ret, error_type, error_val)) {
res.set_uint(val);
@ -1345,7 +1345,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break;
}
case ObDateTimeType: {
int64_t val;
int64_t val = 0;
ret = cast_to_datetime(j_base, accuracy, val);
if (ret == OB_ERR_NULL_VALUE) {
res.set_null();
@ -1366,7 +1366,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break;
}
case ObDateType: {
int32_t val;
int32_t val = 0;
ret = cast_to_date(j_base, val);
if (!try_set_error_val<ObDatum>(res, ret, error_type, error_val)) {
res.set_date(val);
@ -1374,7 +1374,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break;
}
case ObTimeType: {
int64_t val;
int64_t val = 0;
ret = cast_to_time(j_base, accuracy, val);
if (!try_set_error_val<ObDatum>(res, ret, error_type, error_val)) {
res.set_time(val);
@ -1382,7 +1382,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break;
}
case ObYearType: {
uint8_t val;
uint8_t val = 0;
ret = cast_to_year(j_base, val);
if (!try_set_error_val<ObDatum>(res, ret, error_type, error_val)) {
res.set_year(val);
@ -1391,7 +1391,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
}
case ObFloatType:
case ObUFloatType: {
float out_val;
float out_val = 0;
ret = cast_to_float(j_base, dst_type, out_val);
if (!try_set_error_val<ObDatum>(res, ret, error_type, error_val)) {
res.set_float(out_val);
@ -1400,7 +1400,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
}
case ObDoubleType:
case ObUDoubleType: {
double out_val;
double out_val = 0;
ret = cast_to_double(j_base, dst_type, out_val);
if (!try_set_error_val<ObDatum>(res, ret, error_type, error_val)) {
res.set_double(out_val);
@ -1442,7 +1442,7 @@ int ObExprJsonValue::cast_to_res(common::ObIAllocator *allocator,
break;
}
case ObBitType: {
uint64_t out_val;
uint64_t out_val = 0;
ret = cast_to_bit(j_base, out_val);
if (!try_set_error_val<ObDatum>(res, ret, error_type, error_val)) {
res.set_bit(out_val);