diff --git a/src/sql/engine/expr/ob_expr_relational_equal_type.map b/src/sql/engine/expr/ob_expr_relational_equal_type.map index 47f3dfb2b..490b59773 100644 --- a/src/sql/engine/expr/ob_expr_relational_equal_type.map +++ b/src/sql/engine/expr/ob_expr_relational_equal_type.map @@ -63,16 +63,16 @@ static constexpr ObObjType RELATIONAL_EQUAL_TYPE[ObMaxType] = static constexpr ObObjType ORACLE_RELATIONAL_EQUAL_TYPE[ObMaxType] = { ObMaxType, /* NullType */ - ObMaxType, /* TinyIntType */ - ObMaxType, /* SmallIntType */ - ObMaxType, /* MediumIntType */ - ObMaxType, /* Int32Type */ - ObMaxType, /* IntType */ - ObMaxType, /* UTinyIntType */ - ObMaxType, /* USmallIntType */ - ObMaxType, /* UMediumIntType */ - ObMaxType, /* UInt32Type */ - ObMaxType, /* UIntType */ + ObIntType, /* TinyIntType */ + ObIntType, /* SmallIntType */ + ObIntType, /* MediumIntType */ + ObIntType, /* Int32Type */ + ObIntType, /* IntType */ + ObIntType, /* UTinyIntType */ + ObIntType, /* USmallIntType */ + ObIntType, /* UMediumIntType */ + ObIntType, /* UInt32Type */ + ObIntType, /* UIntType */ ObFloatType, /* FloatType */ ObDoubleType, /* DoubleType */ ObMaxType, /* UFloatType */ diff --git a/src/sql/rewrite/ob_transform_predicate_move_around.cpp b/src/sql/rewrite/ob_transform_predicate_move_around.cpp index e277195e6..b2a0f19a6 100644 --- a/src/sql/rewrite/ob_transform_predicate_move_around.cpp +++ b/src/sql/rewrite/ob_transform_predicate_move_around.cpp @@ -2133,7 +2133,8 @@ int ObTransformPredicateMoveAround::pushdown_into_where(ObDMLStmt &stmt, ObSqlBitSet<> table_set; bool is_needed = false; OPT_TRACE("try to transform where condition"); - ObIArray &conditions = (stmt.is_insert_stmt() || stmt.is_merge_stmt()) + bool is_insert_stmt = stmt.is_insert_stmt() || stmt.is_merge_stmt(); + ObIArray &conditions = is_insert_stmt ? static_cast(stmt).get_sharding_conditions() : stmt.get_condition_exprs(); if (conditions.empty() && predicates.empty()) { @@ -2160,7 +2161,8 @@ int ObTransformPredicateMoveAround::pushdown_into_where(ObDMLStmt &stmt, } else if (OB_FAIL(accept_predicates(stmt, conditions, pullup_preds, - new_conds))) { + new_conds, + is_insert_stmt))) { LOG_WARN("failed to accept predicate", K(ret)); } return ret; @@ -3374,7 +3376,8 @@ int ObTransformPredicateMoveAround::check_need_transform_predicates(ObIArray &conds, ObIArray &properties, - ObIArray &new_conds) + ObIArray &new_conds, + const bool preserve_conds) { int ret = OB_SUCCESS; ObSEArray chosen_preds; @@ -3386,6 +3389,8 @@ int ObTransformPredicateMoveAround::accept_predicates(ObDMLStmt &stmt, } else if (OB_FAIL(equal_param_constraints.assign(stmt.get_query_ctx()->all_equal_param_constraints_)) || OB_FAIL(append(equal_param_constraints, ctx_->equal_param_constraints_))) { LOG_WARN("failed to fill equal param constraints", K(ret)); + } else if (preserve_conds && OB_FAIL(chosen_preds.assign(conds))) { + LOG_WARN("failed to assign conditions", K(ret)); } else { context.init(&stmt.get_query_ctx()->calculable_items_, &equal_param_constraints); } diff --git a/src/sql/rewrite/ob_transform_predicate_move_around.h b/src/sql/rewrite/ob_transform_predicate_move_around.h index c0c13a8da..6d2200090 100644 --- a/src/sql/rewrite/ob_transform_predicate_move_around.h +++ b/src/sql/rewrite/ob_transform_predicate_move_around.h @@ -335,7 +335,8 @@ private: int accept_predicates(ObDMLStmt &stmt, ObIArray &conds, ObIArray &properties, - ObIArray &new_conds); + ObIArray &new_conds, + const bool preserve_conds = false); int extract_generalized_column(ObRawExpr *expr, ObIArray &output);