Example #1
0
//---------------------------------------------------------------------------
//	@function:
//		ConfigureTests
//
//	@doc:
//		Configurations needed before running unittests
//
//---------------------------------------------------------------------------
void ConfigureTests()
{
	// initialize DXL support
	InitDXL();

	CMDCache::Init();

	// load metadata objects into provider file
	{
		CAutoMemoryPool amp;
		IMemoryPool *pmp = amp.Pmp();
		CTestUtils::InitProviderFile(pmp);

		// detach safety
		(void) amp.PmpDetach();
	}

#ifdef GPOS_DEBUG
	// reset xforms factory to exercise xforms ctors and dtors
	CXformFactory::Pxff()->Shutdown();
	GPOS_RESULT eres = CXformFactory::EresInit();

	GPOS_ASSERT(GPOS_OK == eres);
#endif // GPOS_DEBUG
}
Example #2
0
//---------------------------------------------------------------------------
//      @function:
//              gpopt_init
//
//      @doc:
//              Initialize gpopt library. To enable memory allocations
//              via a custom allocator, pass in non-NULL fnAlloc/fnFree
//              allocation/deallocation functions. If either of the parameters
//              are NULL, gpopt with be initialized with the default allocator.
//
//---------------------------------------------------------------------------
void gpopt_init()
{
	{
		CAutoMemoryPool amp;
		pmp = amp.Pmp();

		// add standard exception messages
		(void) gpopt::EresExceptionInit(pmp);
	
		// detach safety
		(void) amp.PmpDetach();
	}

	if (GPOS_OK != gpopt::CXformFactory::EresInit())
	{
		return;
	}
}
Example #3
0
//---------------------------------------------------------------------------
//	@function:
//		CColumnFactory::CColumnFactory
//
//	@doc:
//		ctor
//
//---------------------------------------------------------------------------
CColumnFactory::CColumnFactory()
	:
	m_pmp(NULL),
	m_phmcrcrs(NULL)
{
	CAutoMemoryPool amp;
	m_pmp = amp.Pmp();
	
	// initialize hash table
	m_sht.Init
		(
		m_pmp,
		GPOPT_COLFACTORY_HT_BUCKETS,
		GPOS_OFFSET(CColRef, m_link),
		GPOS_OFFSET(CColRef, m_ulId),
		&(CColRef::m_ulInvalid),
		CColRef::UlHash,
		CColRef::FEqual
		);

	// now it's safe to detach the auto pool
	(void) amp.PmpDetach();
}