提交 160d60b2 编写于 作者: S Shreedhar Hardikar 提交者: Shreedhar Hardikar

Fix incorrect check in PciIntervalFromScalarIDF()

When using CConstraintInterval to derive partition filters, we cannot
use a casted Ident, since the cast information is lost. This tripped an
assertion. Also implement FIdentIDFConst().
上级 f6d3ccae
......@@ -209,6 +209,10 @@ namespace gpopt
static
BOOL FCompareIdentToConst(CExpression *pexpr);
// is the given expression of the form (col IS DISTINCT FROM const)
static
BOOL FIdentIDFConst(CExpression *pexpr);
// checks if comparison is between two columns, or a column and a const
static
BOOL FCompareColToConstOrCol(CExpression *pexprScalar);
......
......@@ -445,7 +445,7 @@ CConstraintInterval::PciIntervalFromScalarIDF
GPOS_ASSERT(NULL != pexpr);
GPOS_ASSERT(CPredicateUtils::FIDF(pexpr));
if (CPredicateUtils::FIdentIDFConstIgnoreCast(pexpr))
if (CPredicateUtils::FIdentIDFConst(pexpr))
{
// column
#ifdef GPOS_DEBUG
......
......@@ -1086,6 +1086,39 @@ CPredicateUtils::FCompareIdentToConst
return true;
}
// is the given expression of the form (col IS DISTINCT FROM const)
BOOL
CPredicateUtils::FIdentIDFConst
(
CExpression *pexpr
)
{
COperator *pop = pexpr->Pop();
if (COperator::EopScalarIsDistinctFrom != pop->Eopid())
{
return false;
}
CExpression *pexprLeft = (*pexpr)[0];
CExpression *pexprRight = (*pexpr)[1];
// left side must be scalar ident
if (COperator::EopScalarIdent != pexprLeft->Pop()->Eopid())
{
return false;
}
// right side must be a constant
if (COperator::EopScalarConst != pexprRight->Pop()->Eopid())
{
return false;
}
return true;
}
// is the given expression is of the form (col IS DISTINCT FROM const)
// ignoring cast on either sides
BOOL
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册