ob_log_update.h 2.4 KB
Newer Older
O
oceanbase-admin 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/**
 * Copyright (c) 2021 OceanBase
 * OceanBase CE is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */

#ifndef _OB_LOG_UPDATE_H
#define _OB_LOG_UPDATE_H 1
#include "ob_log_del_upd.h"

namespace oceanbase {
namespace sql {
class ObLogUpdate : public ObLogDelUpd {
G
gm 已提交
20
public:
O
oceanbase-admin 已提交
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
  ObLogUpdate(ObLogPlan& plan) : ObLogDelUpd(plan), tables_assignments_(NULL), update_set_(false)
  {}
  virtual ~ObLogUpdate()
  {}

  int calc_cost();
  void set_tables_assignments(const ObTablesAssignments* assigns)
  {
    tables_assignments_ = assigns;
  }
  const ObTablesAssignments* get_tables_assignments() const
  {
    return tables_assignments_;
  }

L
LINxiansheng 已提交
36 37
  virtual int copy_without_child(ObLogicalOperator*& out) override;
  int allocate_exchange_post(AllocExchContext* ctx) override;
O
oceanbase-admin 已提交
38

L
LINxiansheng 已提交
39
  virtual int est_cost() override;
O
oceanbase-admin 已提交
40

L
LINxiansheng 已提交
41
  virtual uint64_t hash(uint64_t seed) const override;
O
oceanbase-admin 已提交
42
  virtual int allocate_expr_pre(ObAllocExprContext& ctx) override;
L
LINxiansheng 已提交
43 44
  virtual int check_output_dep_specific(ObRawExprCheckDep& checker) override;
  virtual const char* get_name() const override;
O
oceanbase-admin 已提交
45 46 47 48 49 50 51 52 53
  void set_update_set(bool update_set)
  {
    update_set_ = update_set;
  }
  bool is_update_set()
  {
    return update_set_;
  }

Z
zz0 已提交
54 55 56 57
  virtual int inner_replace_generated_agg_expr(
      const common::ObIArray<std::pair<ObRawExpr *, ObRawExpr *> > &to_replace_exprs) override;

  virtual int inner_append_not_produced_exprs(ObRawExprUniqueSet &raw_exprs) const override;
O
oceanbase-admin 已提交
58

G
gm 已提交
59
private:
L
LINxiansheng 已提交
60
  virtual int print_my_plan_annotation(char* buf, int64_t& buf_len, int64_t& pos, ExplainType type) override;
O
oceanbase-admin 已提交
61 62 63 64 65

  int get_update_table(ObDMLStmt* stmt, ObColumnRefRawExpr* col_expr, uint64_t& ref_id);

  virtual int need_multi_table_dml(AllocExchContext& ctx, ObShardingInfo& sharding_info, bool& is_needed) override;

G
gm 已提交
66
private:
O
oceanbase-admin 已提交
67 68 69 70 71 72 73 74 75
  // MySQL only, https://dev.mysql.com/doc/refman/8.0/en/update.html
  const ObTablesAssignments* tables_assignments_;
  // update ... set (a,b) = (subquery), (d,e) = (subquery)
  bool update_set_;
  DISALLOW_COPY_AND_ASSIGN(ObLogUpdate);
};
}  // namespace sql
}  // namespace oceanbase
#endif