Fix remove_const bug
This commit is contained in:
		| @ -181,6 +181,8 @@ public: | ||||
|   int add_replace_exprs(const ObIArray<ObRawExpr *> &from_exprs, | ||||
|                         const ObIArray<ObRawExpr *> &to_exprs, | ||||
|                         const ObIArray<ObRawExpr *> *skip_exprs = NULL); | ||||
|   void set_skip_bool_param_mysql(bool skip) { replacer_.set_skip_bool_param_mysql(skip); } | ||||
|   bool is_skip_bool_param_mysql() { return replacer_.is_skip_bool_param_mysql(); } | ||||
| private: | ||||
|   int add_skip_expr(const ObRawExpr *skip_expr); | ||||
|   int check_expr_need_skip(const ObRawExpr *skip_expr, bool &need_skip); | ||||
|  | ||||
| @ -21,7 +21,7 @@ namespace oceanbase | ||||
| namespace sql | ||||
| { | ||||
| ObRawExprReplacer::ObRawExprReplacer() | ||||
|   : replace_happened_(false) | ||||
|   : replace_happened_(false), skip_bool_param_mysql_(false) | ||||
| {} | ||||
|  | ||||
| ObRawExprReplacer::~ObRawExprReplacer() | ||||
| @ -117,6 +117,15 @@ int ObRawExprReplacer::visit(ObOpRawExpr &expr) | ||||
|     for (int64_t i = 0; OB_SUCC(ret) && i < count; ++i) { | ||||
|       if (OB_FAIL(check_need_replace(expr.get_param_expr(i), new_expr, need_replace))) { | ||||
|         LOG_WARN("failed to check need replace", K(ret)); | ||||
|       } else if (is_skip_bool_param_mysql()) { | ||||
|         if (T_OP_IS == expr.get_expr_type() && i == 1) { | ||||
|           //do nothing | ||||
|         } else if (T_OP_IS_NOT == expr.get_expr_type() && i == 1) { | ||||
|           //do nothing | ||||
|         } else if (need_replace) { | ||||
|           ret = expr.replace_param_expr(i, new_expr); | ||||
|           replace_happened_ = true; | ||||
|         } | ||||
|       } else if (need_replace) { | ||||
|         ret = expr.replace_param_expr(i, new_expr); | ||||
|         replace_happened_ = true; | ||||
|  | ||||
| @ -54,6 +54,8 @@ public: | ||||
|  | ||||
|   virtual bool skip_child(ObRawExpr &expr) override; | ||||
|   bool get_replace_happened() const { return replace_happened_; } | ||||
|   void set_skip_bool_param_mysql(bool skip) { skip_bool_param_mysql_ = skip; } | ||||
|   bool is_skip_bool_param_mysql() { return skip_bool_param_mysql_; } | ||||
|   int add_replace_expr(ObRawExpr *from_expr, | ||||
|                        ObRawExpr *to_expr); | ||||
|   int add_replace_exprs(const ObIArray<ObRawExpr *> &from_exprs, | ||||
| @ -78,6 +80,9 @@ private: | ||||
|   hash::ObHashMap<uint64_t, uint64_t> expr_replace_map_; | ||||
|  | ||||
|   bool replace_happened_; | ||||
|    //If true, skip param epxrs which are resolved as flags instead of exprs in mysql. | ||||
|    //(e.g. the second param of IS expr) | ||||
|   bool skip_bool_param_mysql_; | ||||
| }; | ||||
|  | ||||
| } // end namespace sql | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 2149
					2149