greenplumn CScalarAssertConstraint 源码
greenplumn CScalarAssertConstraint 代码
文件路径:/src/backend/gporca/libgpopt/src/operators/CScalarAssertConstraint.cpp
//---------------------------------------------------------------------------
// Greenplum Database
// Copyright (C) 2015 VMware, Inc. or its affiliates.
//
// @filename:
// CScalarAssertConstraint.cpp
//
// @doc:
// Implementation of scalar assert constraint
//---------------------------------------------------------------------------
#include "gpopt/operators/CScalarAssertConstraint.h"
#include "gpos/base.h"
#include "gpopt/base/COptCtxt.h"
#include "naucrates/md/IMDTypeBool.h"
using namespace gpopt;
using namespace gpmd;
//---------------------------------------------------------------------------
// @function:
// CScalarAssertConstraint::CScalarAssertConstraint
//
// @doc:
// Ctor
//
//---------------------------------------------------------------------------
CScalarAssertConstraint::CScalarAssertConstraint(CMemoryPool *mp,
CWStringBase *pstrErrorMsg)
: CScalar(mp), m_pstrErrorMsg(pstrErrorMsg)
{
GPOS_ASSERT(nullptr != pstrErrorMsg);
}
//---------------------------------------------------------------------------
// @function:
// CScalarAssertConstraint::CScalarAssertConstraint
//
// @doc:
// Dtor
//
//---------------------------------------------------------------------------
CScalarAssertConstraint::~CScalarAssertConstraint()
{
GPOS_DELETE(m_pstrErrorMsg);
}
//---------------------------------------------------------------------------
// @function:
// CScalarAssertConstraint::Matches
//
// @doc:
// Match function on operator level
//
//---------------------------------------------------------------------------
BOOL
CScalarAssertConstraint::Matches(COperator *pop) const
{
if (pop->Eopid() != Eopid())
{
return false;
}
return m_pstrErrorMsg->Equals(
CScalarAssertConstraint::PopConvert(pop)->PstrErrorMsg());
}
//---------------------------------------------------------------------------
// @function:
// CScalarAssertConstraint::OsPrint
//
// @doc:
// debug print
//
//---------------------------------------------------------------------------
IOstream &
CScalarAssertConstraint::OsPrint(IOstream &os) const
{
os << SzId() << " (ErrorMsg: ";
os << PstrErrorMsg()->GetBuffer();
os << ")";
return os;
}
//---------------------------------------------------------------------------
// @function:
// CScalarAssertConstraint::MdidType
//
// @doc:
// Type of expression's result
//
//---------------------------------------------------------------------------
IMDId *
CScalarAssertConstraint::MdidType() const
{
CMDAccessor *md_accessor = COptCtxt::PoctxtFromTLS()->Pmda();
return md_accessor->PtMDType<IMDTypeBool>()->MDId();
}
// EOF
相关信息
相关文章
greenplumn CExpressionFactorizer 源码
greenplumn CExpressionHandle 源码
greenplumn CExpressionPreprocessor 源码
greenplumn CExpressionUtils 源码
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
7、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦