[CP] fix bug for opensouce
This commit is contained in:
@ -980,7 +980,7 @@ int ObChunkRowStore::load_next_chunk_blocks(ChunkIterator& it)
|
||||
LOG_DEBUG(
|
||||
"load chunk", KP(last_blk_end), K_(it.cur_iter_blk_->blk_size), KP(chunk_end), K(chunk_end - last_blk_end));
|
||||
if (chunk_end > last_blk_end) {
|
||||
MEMCPY(it.chunk_mem_, last_blk_end, chunk_end - last_blk_end);
|
||||
MEMMOVE(it.chunk_mem_, last_blk_end, chunk_end - last_blk_end);
|
||||
read_off += chunk_end - last_blk_end;
|
||||
}
|
||||
}
|
||||
@ -1103,6 +1103,10 @@ int ObChunkRowStore::load_next_block(ChunkIterator& it)
|
||||
} else if (it.cur_nth_blk_ < -1 || it.cur_nth_blk_ >= n_blocks_) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("row should be saved", K(ret), K_(it.cur_nth_blk), K_(n_blocks));
|
||||
} else if (it.chunk_read_size_ > ObChunkRowStore::BLOCK_SIZE
|
||||
&& it.chunk_read_size_ < this->max_blk_size_) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("get unexpected read size", K(ret), K(it.chunk_read_size_), K(this->max_blk_size_));
|
||||
} else if (is_file_open() && !it.read_file_iter_end()) {
|
||||
if (it.chunk_read_size_ > 0 && it.chunk_read_size_ >= this->max_blk_size_) {
|
||||
if (OB_FAIL(load_next_chunk_blocks(it))) {
|
||||
@ -1351,6 +1355,11 @@ int ObChunkRowStore::ChunkIterator::init(ObChunkRowStore* store, int64_t chunk_r
|
||||
int ret = OB_SUCCESS;
|
||||
store_ = store;
|
||||
chunk_read_size_ = chunk_read_size;
|
||||
CK (is_valid());
|
||||
if (OB_SUCC(ret) && chunk_read_size > ObChunkRowStore::BLOCK_SIZE
|
||||
&& chunk_read_size < store_->max_blk_size_) {
|
||||
chunk_read_size_ = store_->max_blk_size_;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -2327,16 +2327,20 @@ CAST_FUNC_NAME(number, double)
|
||||
{
|
||||
EVAL_ARG()
|
||||
{
|
||||
const number::ObNumber nmb(child_res->get_number());
|
||||
const char* nmb_buf = nmb.format();
|
||||
if (OB_ISNULL(nmb_buf)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("nmb_buf is NULL", K(ret));
|
||||
if (child_res->is_null()) {
|
||||
res_datum.set_null();
|
||||
} else {
|
||||
ObString num_str(strlen(nmb_buf), nmb_buf);
|
||||
DEF_IN_OUT_TYPE();
|
||||
if (OB_FAIL(common_string_double(expr, in_type, out_type, num_str, res_datum))) {
|
||||
LOG_WARN("common_string_double failed", K(ret), K(num_str));
|
||||
const number::ObNumber nmb(child_res->get_number());
|
||||
const char *nmb_buf = nmb.format();
|
||||
if (OB_ISNULL(nmb_buf)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("nmb_buf is NULL", K(ret));
|
||||
} else {
|
||||
ObString num_str(strlen(nmb_buf), nmb_buf);
|
||||
DEF_IN_OUT_TYPE();
|
||||
if (OB_FAIL(common_string_double(expr, in_type, out_type, num_str, res_datum))) {
|
||||
LOG_WARN("common_string_double failed", K(ret), K(num_str));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5277,104 +5281,129 @@ int uint_to_set(const uint64_t input_value, const ObIArray<ObString>& str_values
|
||||
|
||||
CAST_ENUMSET_FUNC_NAME(int, enum)
|
||||
{
|
||||
EVAL_ARG()
|
||||
{
|
||||
int warning = 0;
|
||||
uint64_t val_uint = static_cast<uint64_t>(child_res->get_int());
|
||||
uint64_t value = 0;
|
||||
ret = uint_to_enum(val_uint, str_values, cast_mode, warning, value);
|
||||
SET_RES_ENUM(value);
|
||||
EVAL_ARG() {
|
||||
if (child_res->is_null()) {
|
||||
res_datum.set_null();
|
||||
} else {
|
||||
int warning = 0;
|
||||
uint64_t val_uint = static_cast<uint64_t>(child_res->get_int());
|
||||
uint64_t value = 0;
|
||||
ret = uint_to_enum(val_uint, str_values, cast_mode, warning, value);
|
||||
SET_RES_ENUM(value);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
CAST_ENUMSET_FUNC_NAME(int, set)
|
||||
{
|
||||
EVAL_ARG()
|
||||
{
|
||||
int warning = 0;
|
||||
uint64_t val_uint = static_cast<uint64_t>(child_res->get_int());
|
||||
uint64_t value = 0;
|
||||
ret = uint_to_set(val_uint, str_values, cast_mode, warning, value);
|
||||
SET_RES_SET(value);
|
||||
EVAL_ARG() {
|
||||
if (child_res->is_null()) {
|
||||
res_datum.set_null();
|
||||
} else {
|
||||
int warning = 0;
|
||||
uint64_t val_uint = static_cast<uint64_t>(child_res->get_int());
|
||||
uint64_t value = 0;
|
||||
ret = uint_to_set(val_uint, str_values, cast_mode, warning, value);
|
||||
SET_RES_SET(value);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
CAST_ENUMSET_FUNC_NAME(uint, enum)
|
||||
{
|
||||
EVAL_ARG()
|
||||
{
|
||||
int warning = 0;
|
||||
uint64_t val_uint = child_res->get_uint();
|
||||
uint64_t value = 0;
|
||||
ret = uint_to_enum(val_uint, str_values, cast_mode, warning, value);
|
||||
SET_RES_ENUM(value);
|
||||
EVAL_ARG() {
|
||||
if (child_res->is_null()) {
|
||||
res_datum.set_null();
|
||||
} else {
|
||||
int warning = 0;
|
||||
uint64_t val_uint = child_res->get_uint();
|
||||
uint64_t value = 0;
|
||||
ret = uint_to_enum(val_uint, str_values, cast_mode, warning, value);
|
||||
SET_RES_ENUM(value);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
CAST_ENUMSET_FUNC_NAME(uint, set)
|
||||
{
|
||||
EVAL_ARG()
|
||||
{
|
||||
int warning = 0;
|
||||
uint64_t val_uint = child_res->get_uint();
|
||||
uint64_t value = 0;
|
||||
ret = uint_to_set(val_uint, str_values, cast_mode, warning, value);
|
||||
SET_RES_SET(value);
|
||||
EVAL_ARG() {
|
||||
if (child_res->is_null()) {
|
||||
res_datum.set_null();
|
||||
} else {
|
||||
int warning = 0;
|
||||
uint64_t val_uint = child_res->get_uint();
|
||||
uint64_t value = 0;
|
||||
ret = uint_to_set(val_uint, str_values, cast_mode, warning, value);
|
||||
SET_RES_SET(value);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
CAST_ENUMSET_FUNC_NAME(float, enum)
|
||||
{
|
||||
EVAL_ARG()
|
||||
{
|
||||
int warning = 0;
|
||||
uint64_t val_uint = static_cast<uint64_t>(static_cast<int64_t>(child_res->get_float()));
|
||||
uint64_t value = 0;
|
||||
ret = uint_to_enum(val_uint, str_values, cast_mode, warning, value);
|
||||
SET_RES_ENUM(value);
|
||||
EVAL_ARG() {
|
||||
if (child_res->is_null()) {
|
||||
res_datum.set_null();
|
||||
} else {
|
||||
int warning = 0;
|
||||
uint64_t val_uint = static_cast<uint64_t>(static_cast<int64_t>(child_res->get_float()));
|
||||
uint64_t value = 0;
|
||||
ret = uint_to_enum(val_uint, str_values, cast_mode, warning, value);
|
||||
SET_RES_ENUM(value);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
CAST_ENUMSET_FUNC_NAME(float, set)
|
||||
{
|
||||
EVAL_ARG()
|
||||
{
|
||||
int warning = 0;
|
||||
uint64_t val_uint = static_cast<uint64_t>(static_cast<int64_t>(child_res->get_float()));
|
||||
uint64_t value = 0;
|
||||
ret = uint_to_set(val_uint, str_values, cast_mode, warning, value);
|
||||
SET_RES_SET(value);
|
||||
EVAL_ARG() {
|
||||
if (child_res->is_null()) {
|
||||
res_datum.set_null();
|
||||
} else {
|
||||
int warning = 0;
|
||||
uint64_t val_uint = static_cast<uint64_t>(static_cast<int64_t>(child_res->get_float()));
|
||||
uint64_t value = 0;
|
||||
ret = uint_to_set(val_uint, str_values, cast_mode, warning, value);
|
||||
SET_RES_SET(value);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
CAST_ENUMSET_FUNC_NAME(double, enum)
|
||||
{
|
||||
EVAL_ARG()
|
||||
{
|
||||
int warning = 0;
|
||||
uint64_t val_uint = static_cast<uint64_t>(static_cast<int64_t>(child_res->get_double()));
|
||||
uint64_t value = 0;
|
||||
ret = uint_to_enum(val_uint, str_values, cast_mode, warning, value);
|
||||
SET_RES_ENUM(value);
|
||||
EVAL_ARG() {
|
||||
if (child_res->is_null()) {
|
||||
res_datum.set_null();
|
||||
} else {
|
||||
int warning = 0;
|
||||
uint64_t val_uint = static_cast<uint64_t>(static_cast<int64_t>(child_res->get_double()));
|
||||
uint64_t value = 0;
|
||||
ret = uint_to_enum(val_uint, str_values, cast_mode, warning, value);
|
||||
SET_RES_ENUM(value);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
CAST_ENUMSET_FUNC_NAME(double, set)
|
||||
{
|
||||
EVAL_ARG()
|
||||
{
|
||||
int warning = 0;
|
||||
uint64_t val_uint = static_cast<uint64_t>(static_cast<int64_t>(child_res->get_double()));
|
||||
uint64_t value = 0;
|
||||
ret = uint_to_set(val_uint, str_values, cast_mode, warning, value);
|
||||
SET_RES_SET(value);
|
||||
EVAL_ARG() {
|
||||
if (child_res->is_null()) {
|
||||
res_datum.set_null();
|
||||
} else {
|
||||
int warning = 0;
|
||||
uint64_t val_uint = static_cast<uint64_t>(static_cast<int64_t>(child_res->get_double()));
|
||||
uint64_t value = 0;
|
||||
ret = uint_to_set(val_uint, str_values, cast_mode, warning, value);
|
||||
SET_RES_SET(value);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -5385,6 +5414,7 @@ CAST_ENUMSET_FUNC_NAME(number, enum)
|
||||
int warning = 0;
|
||||
if (OB_FAIL(number_double(expr, ctx, res_datum))) {
|
||||
LOG_WARN("fail to cast number to double", K(expr), K(ret));
|
||||
} else if (res_datum.is_null()) {
|
||||
} else {
|
||||
uint64_t val_uint = static_cast<uint64_t>(static_cast<int64_t>(res_datum.get_double()));
|
||||
uint64_t value = 0;
|
||||
@ -5400,6 +5430,7 @@ CAST_ENUMSET_FUNC_NAME(number, set)
|
||||
int warning = 0;
|
||||
if (OB_FAIL(number_double(expr, ctx, res_datum))) {
|
||||
LOG_WARN("fail to cast number to double", K(expr), K(ret));
|
||||
} else if (res_datum.is_null()) {
|
||||
} else {
|
||||
uint64_t val_uint = static_cast<uint64_t>(static_cast<int64_t>(res_datum.get_double()));
|
||||
uint64_t value = 0;
|
||||
|
||||
@ -698,11 +698,16 @@ int ObExprDiv::div_number(
|
||||
// const int64_t new_scale2 = ROUND_UP(scale2);
|
||||
// const int64_t calc_scale = ROUND_UP(new_scale1 + new_scale2 + div_pi);
|
||||
const int64_t calc_scale = expr.div_calc_scale_;
|
||||
if (calc_scale > 0 && OB_FAIL(result_num.trunc(calc_scale))) {
|
||||
// calc_scale is calc_scale ,not res_scale.
|
||||
// trunc with calc_scale and round with res_scale
|
||||
LOG_WARN("failed to trunc result number", K(ret), K(result_num), K(calc_scale));
|
||||
} else {
|
||||
if (calc_scale > 0) {
|
||||
if (T_OP_AGG_DIV == expr.type_) {
|
||||
if (OB_FAIL(result_num.round(expr.datum_meta_.scale_))) {
|
||||
LOG_WARN("failed to round result number", K(ret), K(result_num), K(calc_scale));
|
||||
}
|
||||
} else if (OB_FAIL(result_num.trunc(calc_scale))) {
|
||||
LOG_WARN("failed to round result number", K(ret), K(result_num), K(calc_scale));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
result.set_number(result_num);
|
||||
}
|
||||
LOG_DEBUG("finish div",
|
||||
|
||||
@ -111,7 +111,7 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] =
|
||||
ObDoubleType,/*uint*/
|
||||
ObDoubleType,/*float*/
|
||||
ObDoubleType,/*double*/
|
||||
ObNumberType,/*number*/
|
||||
ObDoubleType,/*number*/
|
||||
ObVarcharType,/*datetime*/
|
||||
ObVarcharType,/*date*/
|
||||
ObVarcharType,/*time*/
|
||||
@ -135,8 +135,8 @@ static const ObObjType NVL_TYPE_PROMOTION[ObMaxTC][ObMaxTC] =
|
||||
ObNumberType,/*null*/
|
||||
ObNumberType,/*int*/
|
||||
ObNumberType,/*uint*/
|
||||
ObNumberType,/*float*/
|
||||
ObNumberType,/*double*/
|
||||
ObDoubleType,/*float*/
|
||||
ObDoubleType,/*double*/
|
||||
ObNumberType,/*number*/
|
||||
ObVarcharType,/*datetime*/
|
||||
ObVarcharType,/*date*/
|
||||
|
||||
@ -44,7 +44,7 @@ int ObExprQuote::calc_result_type1(ObExprResType& type, ObExprResType& type1, Ob
|
||||
}
|
||||
} else {
|
||||
type.set_varchar();
|
||||
type.set_length(type1.get_length());
|
||||
type.set_length(2 * type1.get_length() + 2);
|
||||
if OB_FAIL (aggregate_charsets_for_string_result(type, &type1, 1, type_ctx.get_coll_type())) {
|
||||
LOG_WARN("aggregate charset for res failed", K(ret));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user