bugfix json_storage_size for scalar

This commit is contained in:
obdev
2024-02-08 05:11:54 +00:00
committed by ob-robot
parent 63f76b5b53
commit 4db40e18c7
4 changed files with 30 additions and 2 deletions

View File

@ -68,6 +68,19 @@ int ObExprJsonStorageSize::calc(ObEvalCtx &ctx, const ObDatum &data, ObDatumMeta
LOG_WARN("invalid input type", K(type));
} else if (OB_FAIL(ObJsonExprHelper::ensure_collation(type, cs_type))) {
LOG_WARN("fail to ensure collation", K(ret), K(type), K(cs_type));
} else if (ob_is_json(type)) {
// json use lob storage, so no need read full data to get length
ObString j_str = data.get_string();
ObLobLocatorV2 locator(j_str, has_lob_header);
int64_t size = 0;
if (OB_FAIL(locator.get_lob_data_byte_len(size))) {
LOG_WARN("get lob data byte length failed", K(ret), K(locator));
} else if (size > INT32_MAX) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("size overflow", K(ret), K(size), K(locator));
} else {
res.set_int32(size);
}
} else {
uint64_t size = 0;
common::ObString j_str = data.get_string();