[CP] fix distinct clob bug

This commit is contained in:
sdc
2023-10-13 03:43:46 +00:00
committed by ob-robot
parent b660977d13
commit 75b04d6a2b
3 changed files with 21 additions and 29 deletions

View File

@ -1037,6 +1037,13 @@ int ObStaticEngineCG::generate_spec(
if (OB_ISNULL(raw_expr)) {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("null pointer", K(ret));
} else if (is_oracle_mode() && OB_UNLIKELY(ObLongTextType == raw_expr->get_data_type()
|| ObLobType == raw_expr->get_data_type())) {
ret = OB_ERR_INVALID_TYPE_FOR_OP;
LOG_WARN("select distinct lob not allowed", K(ret));
} else if (is_oracle_mode() && OB_UNLIKELY(ObJsonType == raw_expr->get_data_type())) {
ret = OB_ERR_INVALID_CMP_OP;
LOG_WARN("select distinct json not allowed", K(ret));
} else if (raw_expr->is_const_expr()) {
// distinct const value, 这里需要注意:distinct 1被跳过了,
// 但ObMergeDistinct中,如果没有distinct列,则默认所有值都相等,这个语义正好是符合预期的。
@ -1105,6 +1112,13 @@ int ObStaticEngineCG::generate_spec(
if (OB_ISNULL(raw_expr)) {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("null pointer", K(ret));
} else if (is_oracle_mode() && OB_UNLIKELY(ObLongTextType == raw_expr->get_data_type()
|| ObLobType == raw_expr->get_data_type())) {
ret = OB_ERR_INVALID_TYPE_FOR_OP;
LOG_WARN("select distinct lob not allowed", K(ret));
} else if (is_oracle_mode() && OB_UNLIKELY(ObJsonType == raw_expr->get_data_type())) {
ret = OB_ERR_INVALID_CMP_OP;
LOG_WARN("select distinct json not allowed", K(ret));
} else if (raw_expr->is_const_expr()) {
// distinct const value, 这里需要注意:distinct 1被跳过了,
// 但ObMergeDistinct中,如果没有distinct列,则默认所有值都相等,这个语义正好是符合预期的。
@ -1693,6 +1707,13 @@ int ObStaticEngineCG::fill_sort_funcs(
// other udt types not supported, xmltype does not have order or map member function
ret = OB_ERR_NO_ORDER_MAP_SQL;
LOG_WARN("cannot ORDER objects without MAP or ORDER method", K(ret));
} else if (is_oracle_mode() && OB_UNLIKELY(ObLongTextType == expr->datum_meta_.type_
|| ObLobType == expr->datum_meta_.type_)) {
ret = OB_ERR_INVALID_TYPE_FOR_OP;
LOG_WARN("order by lob not allowed", K(ret));
} else if (is_oracle_mode() && OB_UNLIKELY(ObJsonType == expr->datum_meta_.type_)) {
ret = OB_ERR_INVALID_CMP_OP;
LOG_WARN("order by json not allowed", K(ret));
} else {
ObSortCmpFunc cmp_func;
cmp_func.cmp_func_ = ObDatumFuncs::get_nullsafe_cmp_func(expr->datum_meta_.type_,