diff --git a/src/sql/code_generator/ob_static_engine_cg.cpp b/src/sql/code_generator/ob_static_engine_cg.cpp index 47077b19fb..6d6a2bd6d2 100644 --- a/src/sql/code_generator/ob_static_engine_cg.cpp +++ b/src/sql/code_generator/ob_static_engine_cg.cpp @@ -5630,10 +5630,6 @@ int ObStaticEngineCG::fill_aggr_info(ObAggFunRawExpr &raw_expr, aggr_info.rollup_idx_ = expr_idx + group_exprs->count(); } } - if (OB_SUCC(ret) && !match) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("unexpected status: the argument of grouping is invalid", K(ret)); - } } // The arguments of grouping_id are the indexs in rollup exprs. @@ -5653,11 +5649,6 @@ int ObStaticEngineCG::fill_aggr_info(ObAggFunRawExpr &raw_expr, LOG_WARN("push_back fail", K(ret)); } } - - if (OB_SUCC(ret) && expr_idx == OB_INVALID_INDEX) { - ret = OB_ERR_WRONG_FIELD_WITH_GROUP; - LOG_WARN("unexpected status: the argument of grouping_id is invalid"); - } } } diff --git a/src/sql/engine/aggregate/ob_aggregate_processor.cpp b/src/sql/engine/aggregate/ob_aggregate_processor.cpp index 04f456fbaa..35e16e4a05 100644 --- a/src/sql/engine/aggregate/ob_aggregate_processor.cpp +++ b/src/sql/engine/aggregate/ob_aggregate_processor.cpp @@ -2187,10 +2187,7 @@ int ObAggregateProcessor::rollup_aggregation(AggrCell &aggr_cell, AggrCell &roll break; } case T_FUN_GROUPING_ID: { - if (OB_UNLIKELY(aggr_info.grouping_idxs_.count() == 0)) { - ret = OB_INVALID_ARGUMENT; - LOG_WARN("param_exprs_ count is not 1", K(aggr_info)); - } else if (-1 == cur_rollup_group_idx) { + if (-1 == cur_rollup_group_idx) { rollup_cell.set_tiny_num_uint(aggr_cell.get_tiny_num_uint()); } else { uint64_t new_value = 0; diff --git a/src/sql/optimizer/ob_sharding_info.cpp b/src/sql/optimizer/ob_sharding_info.cpp index f0e1ad73de..a6570333ff 100644 --- a/src/sql/optimizer/ob_sharding_info.cpp +++ b/src/sql/optimizer/ob_sharding_info.cpp @@ -166,30 +166,28 @@ int ObShardingInfo::set_partition_key( return ret; } -int ObShardingInfo::is_compatible_partition_key(const ObShardingInfo &first_sharding, - const ObShardingInfo &second_sharding, +int ObShardingInfo::is_compatible_partition_key(const ObIArray> &first_part_keys_list, + const ObIArray> &second_part_keys_list, bool &is_compatible) { int ret = OB_SUCCESS; is_compatible = false; - ObSEArray first_part_keys; - ObSEArray second_part_keys; - if (OB_FAIL(first_sharding.get_all_partition_keys(first_part_keys, true))) { - LOG_WARN("failed to get sharding partition keys", K(ret)); - } else if (OB_FAIL(second_sharding.get_all_partition_keys(second_part_keys, true))) { - LOG_WARN("failed to get sharding partition keys", K(ret)); - } else if ((first_part_keys.count() != second_part_keys.count()) || first_part_keys.empty()) { + if (first_part_keys_list.count() != second_part_keys_list.count() || first_part_keys_list.empty()) { is_compatible = false; } else { is_compatible = true; - for (int64_t i = 0; OB_SUCC(ret) && is_compatible && i < first_part_keys.count(); i++) { - if (OB_ISNULL(first_part_keys.at(i)) || OB_ISNULL(second_part_keys.at(i))) { + ObRawExpr *l_part_key = NULL; + ObRawExpr *r_part_key = NULL; + for (int64_t i = 0; OB_SUCC(ret) && is_compatible && i < first_part_keys_list.count(); i++) { + if (OB_UNLIKELY(first_part_keys_list.at(i).empty() || second_part_keys_list.at(i).empty()) + || OB_ISNULL(l_part_key = first_part_keys_list.at(i).at(0)) + || OB_ISNULL(r_part_key = second_part_keys_list.at(i).at(0))) { ret = OB_ERR_UNEXPECTED; - LOG_WARN("get unexpected null", K(first_part_keys.at(i)), K(second_part_keys.at(i)), K(ret)); - } else if (first_part_keys.at(i)->get_data_type() != second_part_keys.at(i)->get_data_type() || - first_part_keys.at(i)->get_collation_type() != second_part_keys.at(i)->get_collation_type()) { + LOG_WARN("get unexpected null", K(l_part_key), K(r_part_key), K(ret)); + } else if (l_part_key->get_data_type() != r_part_key->get_data_type() || + l_part_key->get_collation_type() != r_part_key->get_collation_type()) { is_compatible = false; - } else { /*do nothing*/ } + } } } return ret; @@ -206,6 +204,7 @@ int ObShardingInfo::is_join_key_cover_partition_key(const EqualSets &equal_sets, ObSEArray, 8> first_part_keys; ObSEArray, 8> second_part_keys; is_cover = false; + bool is_compatible = false; if (OB_UNLIKELY(first_keys.count() != second_keys.count())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("get unexpected array count", K(first_keys.count()), K(second_keys.count()), K(ret)); @@ -215,9 +214,12 @@ int ObShardingInfo::is_join_key_cover_partition_key(const EqualSets &equal_sets, } else if (OB_FAIL(extract_partition_key(second_shardings, second_part_keys))) { LOG_WARN("failed to extract partition keys", K(ret)); - } else if (OB_UNLIKELY(first_part_keys.count() != second_part_keys.count())) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("get unexpected array count", K(first_part_keys.count()), K(second_part_keys.count()), K(ret)); + } else if (OB_FAIL(is_compatible_partition_key(first_part_keys, + second_part_keys, + is_compatible))) { + LOG_WARN("failed to check if is comptiable keys", K(ret)); + } else if (!is_compatible) { + /* do nothing */ } else { uint64_t first_masks = 0; uint64_t second_masks = 0; @@ -298,9 +300,8 @@ int ObShardingInfo::extract_partition_key(const ObIArray &inpu LOG_WARN("get unexpected null", K(ret)); } else if (OB_FAIL(input_shardings.at(i)->get_all_partition_keys(partition_keys, true))) { LOG_WARN("failed to get partition keys", K(ret)); - } else if (OB_UNLIKELY(partition_keys.empty())) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("get unexpected error", K(ret)); + } else if (partition_keys.empty()) { + /* do nothing */ } else if (0 == partition_cnt) { partition_cnt = partition_keys.count(); ObSEArray temp_keys; @@ -553,7 +554,6 @@ int ObShardingInfo::check_if_match_partition_wise(const EqualSets &equal_sets, { int ret = OB_SUCCESS; bool is_key_covered = false; - bool is_partkey_compatible = false; ObShardingInfo *first_left_sharding = NULL; ObShardingInfo *first_right_sharding = NULL; is_partition_wise = false; @@ -569,12 +569,6 @@ int ObShardingInfo::check_if_match_partition_wise(const EqualSets &equal_sets, first_left_sharding->is_partition_single_ != first_right_sharding->is_partition_single_ || first_left_sharding->is_subpartition_sinlge_ != first_right_sharding->is_subpartition_sinlge_) { is_partition_wise = false; - } else if (OB_FAIL(is_compatible_partition_key(*first_left_sharding, - *first_right_sharding, - is_partkey_compatible))) { - LOG_WARN("failed to check if is comptiable keys", K(ret)); - } else if (!is_partkey_compatible) { - /*do nothing*/ } else if (OB_FAIL(is_join_key_cover_partition_key(equal_sets, left_keys, left_sharding, @@ -619,7 +613,6 @@ int ObShardingInfo::check_if_match_extended_partition_wise(const EqualSets &equa { int ret = OB_SUCCESS; bool is_key_covered = false; - bool is_partkey_compatible = false; ObShardingInfo *first_left_sharding = NULL; ObShardingInfo *first_right_sharding = NULL; is_ext_partition_wise = false; @@ -634,12 +627,6 @@ int ObShardingInfo::check_if_match_extended_partition_wise(const EqualSets &equa } else if (!first_left_sharding->is_distributed_without_table_location_with_partitioning() || !first_right_sharding->is_distributed_without_table_location_with_partitioning()) { is_ext_partition_wise = false; - } else if (OB_FAIL(is_compatible_partition_key(*first_left_sharding, - *first_right_sharding, - is_partkey_compatible))) { - LOG_WARN("failed to check if is comptiable keys", K(ret)); - } else if (!is_partkey_compatible) { - /*do nothing*/ } else if (OB_FAIL(is_join_key_cover_partition_key(equal_sets, left_keys, left_sharding, diff --git a/src/sql/optimizer/ob_sharding_info.h b/src/sql/optimizer/ob_sharding_info.h index cb4aba6bc4..72b5ae0939 100644 --- a/src/sql/optimizer/ob_sharding_info.h +++ b/src/sql/optimizer/ob_sharding_info.h @@ -322,8 +322,8 @@ private: common::ObIArray &partition_keys); // check whether all partition keys are of the same type - static int is_compatible_partition_key(const ObShardingInfo &first_sharding, - const ObShardingInfo &second_sharding, + static int is_compatible_partition_key(const ObIArray> &first_part_keys_list, + const ObIArray> &second_part_keys_list, bool &is_compatible); // check whether all the partition keys are covered by join keys diff --git a/src/sql/resolver/dml/ob_sql_hint.cpp b/src/sql/resolver/dml/ob_sql_hint.cpp index 17339c8b4a..35f73016bd 100644 --- a/src/sql/resolver/dml/ob_sql_hint.cpp +++ b/src/sql/resolver/dml/ob_sql_hint.cpp @@ -1130,90 +1130,8 @@ int ObStmtHint::merge_stmt_hint(const ObStmtHint &other, LOG_WARN("failed to merge normal hint", K(ret)); } } - if (OB_FAIL(ret)) { - } else if (HINT_DOMINATED_EQUAL == policy) { - if (OB_FAIL(append_array_no_dup(other_opt_hints_, other.other_opt_hints_))) { - LOG_WARN("failed to append other opt hint", K(ret)); - } - } else { - ObSEArray hint_types; - ObSEArray final_hints; - const ObIArray &dominated_hints = LEFT_HINT_DOMINATED == policy ? other_opt_hints_ - : other.other_opt_hints_; - const ObIArray &other_hints = LEFT_HINT_DOMINATED == policy ? other.other_opt_hints_ - : other_opt_hints_; - if (OB_FAIL(merge_other_opt_hint(dominated_hints, true, hint_types, final_hints))) { - LOG_WARN("failed to merge other opt hints", K(ret)); - } else if (OB_FAIL(merge_other_opt_hint(other_hints, false, hint_types, final_hints))) { - LOG_WARN("failed to merge other opt hints", K(ret)); - } else if (OB_FAIL(other_opt_hints_.assign(final_hints))) { - LOG_WARN("failed to assign other opt hints", K(ret)); - } - } - return ret; -} - -int ObStmtHint::merge_other_opt_hint(const ObIArray &hints, - const bool dominated, - ObIArray &hint_types, - ObIArray &final_hints) -{ - int ret = OB_SUCCESS; - ObHint *hint = NULL; - ObItemType hint_type = T_INVALID; - bool exists = false; - static const int64_t classify_cnt = 8; // max count in hint_types - if (classify_cnt == hint_types.count() && !dominated) { - //all classify type exists in dominated hints, do nothing - } else { - for (int64_t i = 0; OB_SUCC(ret) && i < hints.count(); ++i) { - if (OB_ISNULL(hint = hints.at(i))) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("unexpected null", K(ret)); - } else { - switch (hint->get_hint_type()) { - case T_INDEX_HINT: - case T_NO_INDEX_HINT: - case T_FULL_HINT: - case T_INDEX_SS_HINT: - case T_INDEX_SS_ASC_HINT: - case T_INDEX_SS_DESC_HINT: - case T_USE_DAS_HINT: { - hint_type = T_INDEX_HINT; - break; - } - case T_USE_NL: - case T_USE_MERGE: - case T_USE_HASH: { - hint_type = T_USE_NL; - break; - } - case T_USE_NL_MATERIALIZATION: - case T_PQ_DISTRIBUTE: - case T_PQ_MAP: - case T_PX_JOIN_FILTER: - case T_PX_PART_JOIN_FILTER: - case T_TABLE_PARALLEL: { - hint_type = hint->get_hint_type(); - break; - } - default: { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("unexpected hint type in other_opt_hints_", K(ret), K(*hint)); - } - } - if (OB_SUCC(ret)) { - exists = has_exist_in_array(hint_types, hint_type); - if (dominated && !exists && - OB_FAIL(hint_types.push_back(hint_type))) { - LOG_WARN("failed to push back hint type", K(ret)); - } else if ((dominated || !exists) && - OB_FAIL(final_hints.push_back(hint))) { - LOG_WARN("failed to push back hint", K(ret)); - } - } - } - } + if (OB_SUCC(ret) && OB_FAIL(append_array_no_dup(other_opt_hints_, other.other_opt_hints_))) { + LOG_WARN("failed to append other opt hint", K(ret)); } return ret; } diff --git a/src/sql/resolver/dml/ob_sql_hint.h b/src/sql/resolver/dml/ob_sql_hint.h index eecea06bdd..7c225c1928 100644 --- a/src/sql/resolver/dml/ob_sql_hint.h +++ b/src/sql/resolver/dml/ob_sql_hint.h @@ -216,10 +216,6 @@ struct ObStmtHint int set_simple_view_hint(const ObStmtHint *other = NULL); int remove_normal_hints(const ObItemType *hint_array, const int64_t num); int merge_stmt_hint(const ObStmtHint &other, ObHintMergePolicy policy = HINT_DOMINATED_EQUAL); - int merge_other_opt_hint(const ObIArray &hints, - const bool dominated, - ObIArray &hint_types, - ObIArray &final_hints); int merge_hint(ObHint &hint, ObHintMergePolicy policy, ObIArray &conflict_hints); int merge_normal_hint(ObHint &hint, ObHintMergePolicy policy, ObIArray &conflict_hints); int reset_explicit_trans_hint(ObItemType hint_type);