[CP][FEAT MERGE]SDO_GEOMETRY & MYSQL GIS EXPR IMPLEMENT
This commit is contained in:
@ -45,33 +45,19 @@ int ObExprSTIntersects::calc_result_type2(ObExprResType &type,
|
||||
{
|
||||
UNUSED(type_ctx);
|
||||
INIT_SUCC(ret);
|
||||
int unexpected_types = 0;
|
||||
int null_types = 0;
|
||||
|
||||
if (type1.get_type() == ObNullType) {
|
||||
null_types++;
|
||||
} else if (!ob_is_geometry(type1.get_type()) && !ob_is_string_type(type1.get_type())) {
|
||||
unexpected_types++;
|
||||
LOG_WARN("invalid type", K(type1.get_type()));
|
||||
type1.set_calc_type(ObVarcharType);
|
||||
type1.set_calc_collation_type(CS_TYPE_BINARY);
|
||||
}
|
||||
if (type2.get_type() == ObNullType) {
|
||||
null_types++;
|
||||
} else if (!ob_is_geometry(type2.get_type()) && !ob_is_string_type(type2.get_type())) {
|
||||
unexpected_types++;
|
||||
LOG_WARN("invalid type", K(type2.get_type()));
|
||||
}
|
||||
// an invalid type and a null type will return null
|
||||
// an invalid type and a valid type return error
|
||||
if (null_types == 0 && unexpected_types > 0) {
|
||||
ret = OB_ERR_GIS_INVALID_DATA;
|
||||
LOG_USER_ERROR(OB_ERR_GIS_INVALID_DATA, N_ST_INTERSECTS);
|
||||
LOG_WARN("invalid type", K(ret));
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
type.set_int32();
|
||||
type.set_scale(common::ObAccuracy::DDL_DEFAULT_ACCURACY[common::ObIntType].scale_);
|
||||
type.set_precision(common::ObAccuracy::DDL_DEFAULT_ACCURACY[common::ObIntType].precision_);
|
||||
type2.set_calc_type(ObVarcharType);
|
||||
type2.set_calc_collation_type(CS_TYPE_BINARY);
|
||||
}
|
||||
type.set_int32();
|
||||
type.set_scale(common::ObAccuracy::DDL_DEFAULT_ACCURACY[common::ObIntType].scale_);
|
||||
type.set_precision(common::ObAccuracy::DDL_DEFAULT_ACCURACY[common::ObIntType].precision_);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -117,15 +103,18 @@ int ObExprSTIntersects::eval_st_intersects(const ObExpr &expr, ObEvalCtx &ctx, O
|
||||
}
|
||||
LOG_WARN("get type and srid from wkb failed", K(wkb1), K(ret));
|
||||
} else if (OB_FAIL(ObGeoTypeUtil::get_type_srid_from_wkb(wkb2, type2, srid2))) {
|
||||
if (ret == OB_ERR_GIS_INVALID_DATA) {
|
||||
LOG_USER_ERROR(OB_ERR_GIS_INVALID_DATA, N_ST_INTERSECTS);
|
||||
}
|
||||
LOG_WARN("get type and srid from wkb failed", K(wkb2), K(ret));
|
||||
} else if (srid1 != srid2) {
|
||||
LOG_WARN("srid not the same", K(srid1), K(srid2));
|
||||
ret = OB_ERR_GIS_DIFFERENT_SRIDS;
|
||||
} else if (OB_FAIL(ObGeoExprUtils::get_srs_item(ctx, srs_guard, wkb1, srs, true, N_ST_INTERSECTS))) {
|
||||
LOG_WARN("fail to get srs item", K(ret), K(wkb1));
|
||||
} else if (OB_FAIL(ObGeoExprUtils::build_geometry(temp_allocator, wkb1, geo1, srs, N_ST_INTERSECTS))) {
|
||||
} else if (OB_FAIL(ObGeoExprUtils::build_geometry(temp_allocator, wkb1, geo1, srs, N_ST_INTERSECTS, ObGeoBuildFlag::GEO_ALLOW_3D_DEFAULT))) {
|
||||
LOG_WARN("get first geo by wkb failed", K(ret));
|
||||
} else if (OB_FAIL(ObGeoExprUtils::build_geometry(temp_allocator, wkb2, geo2, srs, N_ST_INTERSECTS))) {
|
||||
} else if (OB_FAIL(ObGeoExprUtils::build_geometry(temp_allocator, wkb2, geo2, srs, N_ST_INTERSECTS, ObGeoBuildFlag::GEO_ALLOW_3D_DEFAULT))) {
|
||||
LOG_WARN("get second geo by wkb failed", K(ret));
|
||||
} else if (OB_FAIL(ObGeoExprUtils::check_empty(geo1, is_geo1_empty))
|
||||
|| OB_FAIL(ObGeoExprUtils::check_empty(geo2, is_geo2_empty))) {
|
||||
|
||||
Reference in New Issue
Block a user