fix st_distance stack overflow
This commit is contained in:
@ -125,7 +125,6 @@ private:
|
|||||||
{
|
{
|
||||||
INIT_SUCC(ret);
|
INIT_SUCC(ret);
|
||||||
common::ObIAllocator *allocator = context.get_allocator();
|
common::ObIAllocator *allocator = context.get_allocator();
|
||||||
typename CollectonType::iterator iter;
|
|
||||||
double min_dist = std::numeric_limits<double>::infinity();
|
double min_dist = std::numeric_limits<double>::infinity();
|
||||||
double temp_res = min_dist;
|
double temp_res = min_dist;
|
||||||
|
|
||||||
@ -134,7 +133,7 @@ private:
|
|||||||
LOG_WARN("Null allocator", K(ret));
|
LOG_WARN("Null allocator", K(ret));
|
||||||
} else if (g1->type() == ObGeoType::GEOMETRYCOLLECTION) {
|
} else if (g1->type() == ObGeoType::GEOMETRYCOLLECTION) {
|
||||||
const CollectonType *geo1 = reinterpret_cast<const CollectonType *>(g1->val());
|
const CollectonType *geo1 = reinterpret_cast<const CollectonType *>(g1->val());
|
||||||
iter = geo1->begin();
|
typename CollectonType::iterator iter = geo1->begin();
|
||||||
for (; iter != geo1->end() && OB_SUCC(ret); iter++) {
|
for (; iter != geo1->end() && OB_SUCC(ret); iter++) {
|
||||||
typename CollectonType::const_pointer sub_ptr = iter.operator->();
|
typename CollectonType::const_pointer sub_ptr = iter.operator->();
|
||||||
ObGeoType sub_type = geo1->get_sub_type(sub_ptr);
|
ObGeoType sub_type = geo1->get_sub_type(sub_ptr);
|
||||||
@ -155,7 +154,7 @@ private:
|
|||||||
}
|
}
|
||||||
} else if (g2->type() == ObGeoType::GEOMETRYCOLLECTION) {
|
} else if (g2->type() == ObGeoType::GEOMETRYCOLLECTION) {
|
||||||
const CollectonType *geo2 = reinterpret_cast<const CollectonType *>(g2->val());
|
const CollectonType *geo2 = reinterpret_cast<const CollectonType *>(g2->val());
|
||||||
iter = geo2->begin();
|
typename CollectonType::iterator iter = geo2->begin();
|
||||||
for (; iter != geo2->end() && OB_SUCC(ret); iter++) {
|
for (; iter != geo2->end() && OB_SUCC(ret); iter++) {
|
||||||
typename CollectonType::const_pointer sub_ptr = iter.operator->();
|
typename CollectonType::const_pointer sub_ptr = iter.operator->();
|
||||||
ObGeoType sub_type = geo2->get_sub_type(sub_ptr);
|
ObGeoType sub_type = geo2->get_sub_type(sub_ptr);
|
||||||
|
|||||||
@ -188,10 +188,8 @@ int ObExprSTDistance::eval_st_distance(const ObExpr &expr, ObEvalCtx &ctx, ObDat
|
|||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
ObDatum *gis_datum1 = NULL;
|
ObDatum *gis_datum1 = NULL;
|
||||||
ObDatum *gis_datum2 = NULL;
|
ObDatum *gis_datum2 = NULL;
|
||||||
ObDatum *gis_unit = NULL;
|
|
||||||
ObExpr *gis_arg1 = expr.args_[0];
|
ObExpr *gis_arg1 = expr.args_[0];
|
||||||
ObExpr *gis_arg2 = expr.args_[1];
|
ObExpr *gis_arg2 = expr.args_[1];
|
||||||
const int max_arg_num = 3;
|
|
||||||
|
|
||||||
ObEvalCtx::TempAllocGuard tmp_alloc_g(ctx);
|
ObEvalCtx::TempAllocGuard tmp_alloc_g(ctx);
|
||||||
common::ObArenaAllocator &temp_allocator = tmp_alloc_g.get_allocator();
|
common::ObArenaAllocator &temp_allocator = tmp_alloc_g.get_allocator();
|
||||||
@ -250,7 +248,9 @@ int ObExprSTDistance::eval_st_distance(const ObExpr &expr, ObEvalCtx &ctx, ObDat
|
|||||||
ObGeoExprUtils::geo_func_error_handle(ret, N_ST_DISTANCE);
|
ObGeoExprUtils::geo_func_error_handle(ret, N_ST_DISTANCE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
const int max_arg_num = 3;
|
||||||
if (expr.arg_cnt_ == max_arg_num) {
|
if (expr.arg_cnt_ == max_arg_num) {
|
||||||
|
ObDatum *gis_unit = NULL;
|
||||||
double factor = 0.0;
|
double factor = 0.0;
|
||||||
if (OB_FAIL(expr.args_[max_arg_num - 1]->eval(ctx, gis_unit))) {
|
if (OB_FAIL(expr.args_[max_arg_num - 1]->eval(ctx, gis_unit))) {
|
||||||
LOG_WARN("eval geo unit arg failed", K(ret));
|
LOG_WARN("eval geo unit arg failed", K(ret));
|
||||||
|
|||||||
Reference in New Issue
Block a user