You need to sign in or sign up before continuing.
ob_any_value_checker.h 2.2 KB
Newer Older
A
al0 已提交
1
/**
O
obdev 已提交
2 3 4 5 6 7 8 9 10
 * 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.
A
al0 已提交
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
 */

#ifndef OCEANBASE_SRC_SQL_RESOLVER_DML_OB_ANY_VALUE_CHECKER_H_
#define OCEANBASE_SRC_SQL_RESOLVER_DML_OB_ANY_VALUE_CHECKER_H_
#include "sql/resolver/expr/ob_raw_expr.h"
#include "sql/resolver/dml/ob_select_stmt.h"

namespace oceanbase {
namespace sql {

class ObAnyValueChecker : public ObRawExprVisitor {
public:
  ObAnyValueChecker() : ObRawExprVisitor(), skip_expr_(nullptr), is_pass_(true)
  {}
  virtual ~ObAnyValueChecker()
  {}
  /// interface of ObRawExprVisitor
  virtual int visit(ObConstRawExpr &expr);
  virtual int visit(ObVarRawExpr &expr);
  virtual int visit(ObQueryRefRawExpr &expr);
  virtual int visit(ObColumnRefRawExpr &expr);
  virtual int visit(ObOpRawExpr &expr);
  virtual int visit(ObCaseOpRawExpr &expr);
  virtual int visit(ObAggFunRawExpr &expr);
  virtual int visit(ObSysFunRawExpr &expr);
  virtual int visit(ObSetOpRawExpr &expr);
  virtual int visit(ObAliasRefRawExpr &expr);
  virtual int visit(ObFunMatchAgainst &expr);
  virtual int visit(ObWinFunRawExpr &expr);
  virtual int visit(ObPseudoColumnRawExpr &expr);

  // set expr skip
  virtual bool skip_child(ObRawExpr &expr)
  {
    return skip_expr_ == &expr;
  }

  int check_select_stmt(const ObSelectStmt *ref_stmt);
  int check_any_value(const ObRawExpr *expr, const ObColumnRefRawExpr *undefined_column);
  bool is_pass_after_check();

private:
  void set_skip_expr(ObRawExpr *expr)
  {
    skip_expr_ = expr;
  }
  const ObColumnRefRawExpr *undefined_column_;
  ObRawExpr *skip_expr_;
  bool is_pass_;
  // disallow copy
  DISALLOW_COPY_AND_ASSIGN(ObAnyValueChecker);
};

}  // namespace sql
}  // namespace oceanbase
#endif  // OCEANBASE_SRC_SQL_RESOLVER_DML_OB_ANY_VALUE_CHECKER_H_