Esempio n. 1
0
//---------------------------------------------------------------------------
//	@function:
//		CLogicalTVF::CLogicalTVF
//
//	@doc:
//		Ctor
//
//---------------------------------------------------------------------------
CLogicalTVF::CLogicalTVF
	(
	IMemoryPool *pmp,
	IMDId *pmdidFunc,
	IMDId *pmdidRetType,
	CWStringConst *pstr,
	DrgPcoldesc *pdrgpcoldesc,
	DrgPcr *pdrgpcrOutput
	)
	:
	CLogical(pmp),
	m_pmdidFunc(pmdidFunc),
	m_pmdidRetType(pmdidRetType),
	m_pstr(pstr),
	m_pdrgpcoldesc(pdrgpcoldesc),
	m_pdrgpcrOutput(pdrgpcrOutput)
{
	GPOS_ASSERT(pmdidFunc->FValid());
	GPOS_ASSERT(pmdidRetType->FValid());
	GPOS_ASSERT(NULL != pstr);
	GPOS_ASSERT(NULL != pdrgpcoldesc);
	GPOS_ASSERT(NULL != pdrgpcrOutput);

	CMDAccessor *pmda = COptCtxt::PoctxtFromTLS()->Pmda();
	const IMDFunction *pmdfunc = pmda->Pmdfunc(m_pmdidFunc);

	m_efs = pmdfunc->EfsStability();
	m_efda = pmdfunc->EfdaDataAccess();
	m_fReturnsSet = pmdfunc->FReturnsSet();
}
Esempio n. 2
0
//---------------------------------------------------------------------------
//	@function:
//		CPhysicalTVF::CPhysicalTVF
//
//	@doc:
//		Ctor
//
//---------------------------------------------------------------------------
CPhysicalTVF::CPhysicalTVF
	(
	IMemoryPool *pmp,
	IMDId *pmdidFunc,
	IMDId *pmdidRetType,
	CWStringConst *pstr,
	DrgPcoldesc *pdrgpcoldesc,
	CColRefSet *pcrsOutput
	)
	:
	CPhysical(pmp),
	m_pmdidFunc(pmdidFunc),
	m_pmdidRetType(pmdidRetType),
	m_pstr(pstr),
	m_pdrgpcoldesc(pdrgpcoldesc),
	m_pcrsOutput(pcrsOutput)
{
	GPOS_ASSERT(m_pmdidFunc->FValid());
	GPOS_ASSERT(m_pmdidRetType->FValid());
	GPOS_ASSERT(NULL != m_pstr);
	GPOS_ASSERT(NULL != m_pdrgpcoldesc);
	GPOS_ASSERT(NULL != m_pcrsOutput);

	CMDAccessor *pmda = COptCtxt::PoctxtFromTLS()->Pmda();
	m_pmdfunc = pmda->Pmdfunc(m_pmdidFunc);
}
Esempio n. 3
0
//---------------------------------------------------------------------------
//	@function:
//		CLogicalTVF::CLogicalTVF
//
//	@doc:
//		Ctor
//
//---------------------------------------------------------------------------
CLogicalTVF::CLogicalTVF
	(
	IMemoryPool *pmp,
	IMDId *pmdidFunc,
	IMDId *pmdidRetType,
	CWStringConst *pstr,
	DrgPcoldesc *pdrgpcoldesc
	)
	:
	CLogical(pmp),
	m_pmdidFunc(pmdidFunc),
	m_pmdidRetType(pmdidRetType),
	m_pstr(pstr),
	m_pdrgpcoldesc(pdrgpcoldesc),
	m_pdrgpcrOutput(NULL)
{
	GPOS_ASSERT(pmdidFunc->FValid());
	GPOS_ASSERT(pmdidRetType->FValid());
	GPOS_ASSERT(NULL != pstr);
	GPOS_ASSERT(NULL != pdrgpcoldesc);

	// generate a default column set for the list of column descriptors
	m_pdrgpcrOutput = PdrgpcrCreateMapping(pmp, pdrgpcoldesc, UlOpId());

	CMDAccessor *pmda = COptCtxt::PoctxtFromTLS()->Pmda();
	const IMDFunction *pmdfunc = pmda->Pmdfunc(m_pmdidFunc);

	m_efs = pmdfunc->EfsStability();
	m_efda = pmdfunc->EfdaDataAccess();
	m_fReturnsSet = pmdfunc->FReturnsSet();
}
Esempio n. 4
0
//---------------------------------------------------------------------------
//	@function:
//		CScalarCast::CScalarCast
//
//	@doc:
//		Ctor
//
//---------------------------------------------------------------------------
CScalarCast::CScalarCast
	(
	IMemoryPool *pmp,
	IMDId *pmdidReturnType,
	IMDId *pmdidFunc,
	BOOL fBinaryCoercible
	)
	:
	CScalar(pmp),
	m_pmdidReturnType(pmdidReturnType),
	m_pmdidFunc(pmdidFunc),
	m_fBinaryCoercible(fBinaryCoercible),
	m_fReturnsNullOnNullInput(false),
	m_fBoolReturnType(false)
{
	if (NULL != m_pmdidFunc && m_pmdidFunc->FValid())
	{
		CMDAccessor *pmda = COptCtxt::PoctxtFromTLS()->Pmda();
		const IMDFunction *pmdfunc = pmda->Pmdfunc(m_pmdidFunc);

		m_fReturnsNullOnNullInput = pmdfunc->FStrict();
		m_fBoolReturnType = CMDAccessorUtils::FBoolType(pmda, m_pmdidReturnType);
	}
}
Esempio n. 5
0
//---------------------------------------------------------------------------
//	@function:
//		CScalarWindowFunc::CScalarWindowFunc
//
//	@doc:
//		Ctor
//
//---------------------------------------------------------------------------
CScalarWindowFunc::CScalarWindowFunc
	(
	IMemoryPool *pmp,
	IMDId *pmdidFunc,
	IMDId *pmdidRetType,
	const CWStringConst *pstrFunc,
	EWinStage ewinstage,
	BOOL fDistinct
	)
	:
	CScalarFunc(pmp),
	m_ewinstage(ewinstage),
	m_fDistinct(fDistinct),
	m_fAgg(false)
{
	GPOS_ASSERT(pmdidFunc->FValid());
	GPOS_ASSERT(pmdidRetType->FValid());
	m_pmdidFunc = pmdidFunc;
	m_pmdidRetType = pmdidRetType;
	m_pstrFunc = pstrFunc;

	CMDAccessor *pmda = COptCtxt::PoctxtFromTLS()->Pmda();
	m_fAgg = pmda->FAggWindowFunc(m_pmdidFunc);
	if (!m_fAgg)
	{
		const IMDFunction *pmdfunc = pmda->Pmdfunc(m_pmdidFunc);
		m_efs = pmdfunc->EfsStability();
		m_efda = pmdfunc->EfdaDataAccess();
	}
	else
	{
 	 	// TODO: , Aug 15, 2012; pull out properties of aggregate functions
		m_efs = IMDFunction::EfsImmutable;
		m_efda = IMDFunction::EfdaNoSQL;
	}
}