//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerScalarSwitch::StartElement
//
//	@doc:
//		Processes a Xerces start element event
//
//---------------------------------------------------------------------------
void
CParseHandlerScalarSwitch::StartElement
	(
	const XMLCh* const xmlszUri,
	const XMLCh* const xmlszLocalname,
	const XMLCh* const xmlszQname,
	const Attributes& attrs
	)
{
	if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenScalarSwitch), xmlszLocalname) && NULL == m_pmdidType)
	{
		// parse type id
		m_pmdidType = CDXLOperatorFactory::PmdidFromAttrs(m_pphm->Pmm(), attrs, EdxltokenTypeId, EdxltokenScalarSwitch);

		// construct node
		CDXLScalarSwitch *pdxlop =  GPOS_NEW(m_pmp) CDXLScalarSwitch(m_pmp, m_pmdidType);
		m_pdxln = GPOS_NEW(m_pmp) CDXLNode(m_pmp, pdxlop);
	}
	else if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenScalarSwitchCase), xmlszLocalname))
	{
		// we must have already seen the arg child, but have not seen the DEFAULT child
		GPOS_ASSERT(NULL != m_pdxln && m_fArgProcessed && !m_fDefaultProcessed);

		// parse case
		CParseHandlerBase *pphCase = CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenScalarSwitchCase), m_pphm, this);
		m_pphm->ActivateParseHandler(pphCase);

		// store parse handlers
		this->Append(pphCase);

		pphCase->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);
	}
	else
	{
		GPOS_ASSERT(NULL != m_pdxln && !m_fDefaultProcessed);

		// parse scalar child
		CParseHandlerBase *pphChild = CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenScalar), m_pphm, this);
		m_pphm->ActivateParseHandler(pphChild);

		// store parse handlers
		this->Append(pphChild);

		pphChild->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);

		if (!m_fArgProcessed)
		{
			// this child was the arg child
			m_fArgProcessed = true;
		}
		else
		{
			// that was the default expr child
			m_fDefaultProcessed = true;
		}
	}
}
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerCostParams::StartElement
//
//	@doc:
//		Invoked by Xerces to process an opening tag
//
//---------------------------------------------------------------------------
void
CParseHandlerCostParams::StartElement
	(
	const XMLCh* const xmlstrUri,
	const XMLCh* const xmlstrLocalname,
	const XMLCh* const xmlstrQname,
	const Attributes& attrs
	)
{
	if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenCostParams), xmlstrLocalname))
	{
		// as of now, we only parse params of GPDB cost model
		m_pcp = GPOS_NEW(m_pmp) CCostModelParamsGPDB(m_pmp);
	}
	else if(0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenCostParam), xmlstrLocalname))
	{
		GPOS_ASSERT(NULL != m_pcp);

		// start new search stage
		CParseHandlerBase *pphCostParam = CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenCostParam), m_pphm, this);
		m_pphm->ActivateParseHandler(pphCostParam);

		// store parse handler
		this->Append(pphCostParam);

		pphCostParam->startElement(xmlstrUri, xmlstrLocalname, xmlstrQname, attrs);
	}
	else
	{
		CWStringDynamic *pstr = CDXLUtils::PstrFromXMLCh(m_pphm->Pmm(), xmlstrLocalname);
		GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag, pstr->Wsz());
	}
}
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerScalarAggref::StartElement
//
//	@doc:
//		Processes a Xerces start element event
//
//---------------------------------------------------------------------------
void
CParseHandlerScalarAggref::StartElement
	(
	const XMLCh* const xmlszUri,
	const XMLCh* const xmlszLocalname,
	const XMLCh* const xmlszQname,
	const Attributes& attrs
	)
{
	if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenScalarAggref), xmlszLocalname))
	{
		// parse and create scalar AggRef
		CDXLScalarAggref *pdxlop = (CDXLScalarAggref*) CDXLOperatorFactory::PdxlopAggFunc(m_pphm->Pmm(), attrs);

		// construct node from the created scalar AggRef
		m_pdxln = GPOS_NEW(m_pmp) CDXLNode(m_pmp, pdxlop);

	}
	else
	{
		// we must have seen an aggref already and initialized the aggref node
		GPOS_ASSERT(NULL != m_pdxln);

		CParseHandlerBase *pph = CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenScalar), m_pphm, this);
		m_pphm->ActivateParseHandler(pph);

		// store parse handlers
		this->Append(pph);

		pph->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);
	}
}
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerDefaultValueExpr::StartElement
//
//	@doc:
//		Processes a Xerces start element event
//
//---------------------------------------------------------------------------
void
CParseHandlerDefaultValueExpr::StartElement
	(
	const XMLCh* const xmlszUri,
	const XMLCh* const xmlszLocalname,
	const XMLCh* const xmlszQname,
	const Attributes& attrs
	)
{
	if(0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenColumnDefaultValue), xmlszLocalname))
	{
		// opening tag for a default expression: assert no other tag has been seen yet
		GPOS_ASSERT(!m_fDefaultValueStarted);
		m_fDefaultValueStarted = true;
	}
	else
	{
		GPOS_ASSERT(m_fDefaultValueStarted);
		
		// install a scalar op parse handler to parse the expression
		CParseHandlerBase *pph = CParseHandlerFactory::Pph(m_pmp, xmlszLocalname, m_pphm, this);
		
		GPOS_ASSERT(NULL != pph);

		// activate the child parse handler
		m_pphm->ActivateParseHandler(pph);
		
		// pass the startElement message for the specialized parse handler to process
		pph->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);
		
		// store parse handlers
		this->Append(pph);
	}

}
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerSearchStrategy::StartElement
//
//	@doc:
//		Invoked by Xerces to process an opening tag
//
//---------------------------------------------------------------------------
void
CParseHandlerSearchStrategy::StartElement
	(
	const XMLCh* const xmlstrUri,
	const XMLCh* const xmlstrLocalname,
	const XMLCh* const xmlstrQname,
	const Attributes& attrs
	)
{
	if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenSearchStrategy), xmlstrLocalname))
	{
		m_pdrgpss = GPOS_NEW(m_pmp) DrgPss(m_pmp);
	}
	else if(0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenSearchStage), xmlstrLocalname))
	{
		GPOS_ASSERT(NULL != m_pdrgpss);

		// start new search stage
		CParseHandlerBase *pphSearchStage = CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenSearchStage), m_pphm, this);
		m_pphm->ActivateParseHandler(pphSearchStage);

		// store parse handler
		this->Append(pphSearchStage);

		pphSearchStage->startElement(xmlstrUri, xmlstrLocalname, xmlstrQname, attrs);
	}
	else
	{
		CWStringDynamic *pstr = CDXLUtils::PstrFromXMLCh(m_pphm->Pmm(), xmlstrLocalname);
		GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag, pstr->Wsz());
	}
}
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerSortColList::StartElement
//
//	@doc:
//		Invoked by Xerces to process an opening tag
//
//---------------------------------------------------------------------------
void
CParseHandlerSortColList::StartElement
	(
	const XMLCh* const xmlszUri,
	const XMLCh* const xmlszLocalname,
	const XMLCh* const xmlszQname,
	const Attributes& attrs
	)
{
	if(0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenScalarSortColList), xmlszLocalname))
	{
		// start the sorting column list
		m_pdxln = GPOS_NEW(m_pmp) CDXLNode (m_pmp, GPOS_NEW(m_pmp) CDXLScalarSortColList(m_pmp));
	}
	else if(0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenScalarSortCol), xmlszLocalname))
	{
		// we must have seen a sorting col list already and initialized the sort col list node
		GPOS_ASSERT(NULL != m_pdxln);

		// start new sort column
		CParseHandlerBase *pphSortCol = CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenScalarSortCol), m_pphm, this);
		m_pphm->ActivateParseHandler(pphSortCol);
		
		// store parse handler
		this->Append(pphSortCol);
		
		pphSortCol->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);
	}
	else
	{
		CWStringDynamic *pstr = CDXLUtils::PstrFromXMLCh(m_pphm->Pmm(), xmlszLocalname);
		GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag, pstr->Wsz());
	}
}
// invoked by Xerces to process an opening tag
void
CParseHandlerScalarValuesList::StartElement
	(
	const XMLCh* const xmlszUri,
	const XMLCh* const xmlszLocalname,
	const XMLCh* const xmlszQname,
	const Attributes& attrs
	)
{
	if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenScalarValuesList), xmlszLocalname))
	{
		CDXLScalarValuesList *pdxlop = GPOS_NEW(m_pmp) CDXLScalarValuesList(m_pmp);
		m_pdxln = GPOS_NEW(m_pmp) CDXLNode(m_pmp, pdxlop);
	}
	else if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenScalarConstValue), xmlszLocalname))
	{
		CParseHandlerBase *pphScConstValue = CParseHandlerFactory::Pph(m_pmp, xmlszLocalname, m_pphm, this);
		m_pphm->ActivateParseHandler(pphScConstValue);

		this->Append(pphScConstValue);

		pphScConstValue->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);
	}
	else
	{
		CWStringDynamic *pstr = CDXLUtils::PstrFromXMLCh(m_pphm->Pmm(), xmlszLocalname);
		GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag, pstr->Wsz());
	}
}
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerWindowSpecList::StartElement
//
//	@doc:
//		Invoked by Xerces to process an opening tag
//
//---------------------------------------------------------------------------
void
CParseHandlerWindowSpecList::StartElement
	(
	const XMLCh* const xmlszUri,
	const XMLCh* const xmlszLocalname,
	const XMLCh* const xmlszQname,
	const Attributes& attrs
	)
{
	if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenWindowSpecList), xmlszLocalname))
	{
		m_pdrgpdxlws = GPOS_NEW(m_pmp) DrgPdxlws(m_pmp);
	}
	else if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenWindowSpec), xmlszLocalname))
	{
		// we must have seen a window specification list already
		GPOS_ASSERT(NULL != m_pdrgpdxlws);
		// start new window specification element
		CParseHandlerBase *pphWs =
				CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenWindowSpec), m_pphm, this);
		m_pphm->ActivateParseHandler(pphWs);

		// store parse handler
		this->Append(pphWs);

		pphWs->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);
	}
	else
	{
		CWStringDynamic *pstr = CDXLUtils::PstrFromXMLCh(m_pphm->Pmm(), xmlszLocalname);
		GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag, pstr->Wsz());
	}
}
Exemplo n.º 9
0
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerResult::StartElement
//
//	@doc:
//		Invoked by Xerces to process an opening tag
//
//---------------------------------------------------------------------------
void
CParseHandlerResult::StartElement
(
    const XMLCh* const xmlszUri,
    const XMLCh* const xmlszLocalname,
    const XMLCh* const xmlszQname,
    const Attributes& attrs
)
{

    if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenPhysicalResult), xmlszLocalname)
            && NULL == m_pdxlop)
    {
        SetupInitialHandlers();
    }
    else if (NULL != m_pdxlop)
    {
        // parse handler for child node
        CParseHandlerBase *pphChild = CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenPhysical), m_pphm, this);
        m_pphm->ActivateParseHandler(pphChild);

        this->Append(pphChild);

        pphChild->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);
    }
    else
    {
        CWStringDynamic *pstr = CDXLUtils::PstrFromXMLCh(m_pphm->Pmm(), xmlszLocalname);
        GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag, pstr->Wsz());
    }
}
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerStatsDerivedRelation::StartElement
//
//	@doc:
//		Invoked by Xerces to process an opening tag
//
//---------------------------------------------------------------------------
void
CParseHandlerStatsDerivedRelation::StartElement
	(
	const XMLCh* const xmlszUri,
	const XMLCh* const xmlszLocalname,
	const XMLCh* const xmlszQname,
	const Attributes& attrs
	)
{
	if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenStatsDerivedColumn), xmlszLocalname))
	{
		// start new derived column element
		CParseHandlerBase *pph = CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenStatsDerivedColumn), m_pphm, this);
		m_pphm->ActivateParseHandler(pph);

		// store parse handler
		this->Append(pph);

		pph->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);
	}
	else
	{
		GPOS_ASSERT(0 == this->UlLength());

		// parse rows
		const XMLCh *xmlszRows = CDXLOperatorFactory::XmlstrFromAttrs
														(
														attrs,
														EdxltokenRows,
														EdxltokenStatsDerivedRelation
														);

		m_dRows = CDouble(CDXLOperatorFactory::DValueFromXmlstr
												(
												m_pphm->Pmm(),
												xmlszRows,
												EdxltokenRows,
												EdxltokenStatsDerivedRelation
												));

		m_fEmpty = false;
		const XMLCh *xmlszEmpty = attrs.getValue(CDXLTokens::XmlstrToken(EdxltokenEmptyRelation));
		if (NULL != xmlszEmpty)
		{
			m_fEmpty = CDXLOperatorFactory::FValueFromXmlstr
											(
											m_pphm->Pmm(),
											xmlszEmpty,
											EdxltokenEmptyRelation,
											EdxltokenStatsDerivedRelation
											);
		}
	}
}
Exemplo n.º 11
0
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerMetadata::StartElement
//
//	@doc:
//		Invoked by Xerces to process an opening tag
//
//---------------------------------------------------------------------------
void
CParseHandlerMetadata::StartElement
	(
	const XMLCh* const xmlszUri,
	const XMLCh* const xmlszLocalname,
	const XMLCh* const xmlszQname,
	const Attributes& attrs
	)
{		
	if(0 == XMLString::compareString(xmlszLocalname, CDXLTokens::XmlstrToken(EdxltokenMetadata)))
	{
		// start of the metadata section in the DXL document
		GPOS_ASSERT(NULL == m_pdrgpmdobj);
		
		m_pdrgpmdobj = GPOS_NEW(m_pmp) DrgPimdobj(m_pmp);
		m_pdrgpmdid = GPOS_NEW(m_pmp) DrgPmdid(m_pmp);
		
		m_pdrgpsysid = PdrgpsysidParse
						(
						attrs, 
						EdxltokenSysids,
						EdxltokenMetadata
						);
	}
	else if (0 == XMLString::compareString(xmlszLocalname, CDXLTokens::XmlstrToken(EdxltokenMdid)))
	{
		// start of the metadata section in the DXL document
		GPOS_ASSERT(NULL != m_pdrgpmdid);
		IMDId *pmdid = CDXLOperatorFactory::PmdidFromAttrs(m_pphm->Pmm(), attrs, EdxltokenValue, EdxltokenMdid);
		m_pdrgpmdid->Append(pmdid);
	}
	else
	{
		// must be a metadata object
		GPOS_ASSERT(NULL != m_pdrgpmdobj);
		
		// install a parse handler for the given element
		CParseHandlerBase *pph = CParseHandlerFactory::Pph(m_pmp, xmlszLocalname, m_pphm, this);

		m_pphm->ActivateParseHandler(pph);
		
		// store parse handler
		this->Append(pph);
		
		pph->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);
	}
}
Exemplo n.º 12
0
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerFilter::StartElement
//
//	@doc:
//		Invoked by Xerces to process an opening tag
//
//---------------------------------------------------------------------------
void
CParseHandlerFilter::StartElement
	(
	const XMLCh* const xmlszUri,
	const XMLCh* const xmlszLocalname,
	const XMLCh* const xmlszQname,
	const Attributes& attrs
	)
{	
	if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenScalarFilter), xmlszLocalname))
	{
		// start the filter
		m_pdxln = GPOS_NEW(m_pmp) CDXLNode (m_pmp, GPOS_NEW(m_pmp) CDXLScalarFilter(m_pmp));
	}
	else if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenScalarJoinFilter), xmlszLocalname))
	{
		// start the filter
		m_pdxln = GPOS_NEW(m_pmp) CDXLNode (m_pmp, GPOS_NEW(m_pmp) CDXLScalarJoinFilter(m_pmp));
	} 
	else if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenScalarOneTimeFilter), xmlszLocalname))
	{
		// start the filter
		m_pdxln = GPOS_NEW(m_pmp) CDXLNode (m_pmp, GPOS_NEW(m_pmp) CDXLScalarOneTimeFilter(m_pmp));
	}
	else if (0 == XMLString::compareString(
			CDXLTokens::XmlstrToken(EdxltokenScalarRecheckCondFilter), xmlszLocalname))
	{
		// start the filter
		m_pdxln = GPOS_NEW(m_pmp) CDXLNode (m_pmp, GPOS_NEW(m_pmp) CDXLScalarRecheckCondFilter(m_pmp));
	}
	else
	{
		GPOS_ASSERT(NULL != m_pdxln);
		
		// install a scalar element parser for parsing the condition element
		CParseHandlerBase *pphOp = CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenScalar), m_pphm, this);

		m_pphm->ActivateParseHandler(pphOp);
		
		// store parse handler
		this->Append(pphOp);
		
		pphOp->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);
		
	}
}
Exemplo n.º 13
0
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerScalarOpExpr::StartElement
//
//	@doc:
//		Processes a Xerces start element event
//
//---------------------------------------------------------------------------
void
CParseHandlerScalarOpExpr::StartElement
(
    const XMLCh* const xmlszUri,
    const XMLCh* const xmlszLocalname,
    const XMLCh* const xmlszQname,
    const Attributes& attrs
)
{
    if(0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenScalarOpExpr), xmlszLocalname) && (NULL == m_pdxln))
    {
        // parse and create scalar OpExpr
        CDXLScalarOpExpr *pdxlop = (CDXLScalarOpExpr*) CDXLOperatorFactory::PdxlopOpExpr(m_pphm->Pmm(), attrs);

        // construct node from the created child nodes
        m_pdxln = GPOS_NEW(m_pmp) CDXLNode(m_pmp, pdxlop);
    }
    else if (NULL != m_pdxln)
    {
        if (2 > m_ulChildCount)
        {
            CParseHandlerBase *pphOp = CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenScalar), m_pphm, this);

            m_pphm->ActivateParseHandler(pphOp);

            // store parse handlers
            this->Append(pphOp);

            pphOp->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);

            m_ulChildCount++;
        }
        else
        {
            CWStringDynamic *pstr = CDXLUtils::PstrFromXMLCh(m_pphm->Pmm(), xmlszLocalname);
            GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag, pstr->Wsz());
        }
    }
    else
    {
        CWStringDynamic *pstr = CDXLUtils::PstrFromXMLCh(m_pphm->Pmm(), xmlszLocalname);

        GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLIncorrectNumberOfChildren, pstr->Wsz());
    }
}
Exemplo n.º 14
0
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerPhysicalOp::StartElement
//
//	@doc:
//		Invoked by Xerces to process an opening tag of a physical operator node.
//		This function serves as a dispatcher for invoking the correct processing
//		function for the respective operator type.
//
//---------------------------------------------------------------------------
void
CParseHandlerPhysicalOp::StartElement
	(
	const XMLCh* const xmlszUri,
	const XMLCh* const xmlszLocalname,
	const XMLCh* const xmlszQname,
	const Attributes& attrs
	)
{
	// instantiate the parse handler
	CParseHandlerBase *pph = CParseHandlerFactory::Pph(m_pmp, xmlszLocalname, m_pphm, this);

	GPOS_ASSERT(NULL != pph);

	// activate the parse handler
	m_pphm->ReplaceHandler(pph, m_pphRoot);
		
	// pass the startElement message for the specialized parse handler to process
	pph->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);
}
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerScalarWindowFrameEdge::StartElement
//
//	@doc:
//		Invoked by Xerces to process an opening tag
//
//---------------------------------------------------------------------------
void
CParseHandlerScalarWindowFrameEdge::StartElement
	(
	const XMLCh* const xmlszUri,
	const XMLCh* const xmlszLocalname,
	const XMLCh* const xmlszQname,
	const Attributes& attrs
	)
{
	if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenScalarWindowFrameLeadingEdge), xmlszLocalname))
	{
		GPOS_ASSERT(NULL == m_pdxln);
		EdxlFrameBoundary edxlfb = CDXLOperatorFactory::Edxlfb(attrs, EdxltokenWindowLeadingBoundary);
		m_pdxln = GPOS_NEW(m_pmp) CDXLNode(m_pmp, GPOS_NEW(m_pmp) CDXLScalarWindowFrameEdge(m_pmp, true /*fLeading*/, edxlfb));
	}
	else if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenScalarWindowFrameTrailingEdge), xmlszLocalname))
	{
		GPOS_ASSERT(NULL == m_pdxln);
		EdxlFrameBoundary edxlfb = CDXLOperatorFactory::Edxlfb(attrs, EdxltokenWindowTrailingBoundary);
		m_pdxln = GPOS_NEW(m_pmp) CDXLNode(m_pmp, GPOS_NEW(m_pmp) CDXLScalarWindowFrameEdge(m_pmp, false /*fLeading*/, edxlfb));
	}
	else
	{
		// we must have seen a Window Frame Edge already and initialized its corresponding node
		if (NULL == m_pdxln)
		{
			CWStringDynamic *pstr = CDXLUtils::PstrFromXMLCh(m_pphm->Pmm(), xmlszLocalname);
			GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag, pstr->Wsz());
		}

		// install a scalar element parser for parsing the frame edge value
		CParseHandlerBase *pphChild = CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenScalar), m_pphm, this);
		m_pphm->ActivateParseHandler(pphChild);

		// store parse handler
		this->Append(pphChild);

		pphChild->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);
	}
}
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerScalarSubPlanTestExpr::StartElement
//
//	@doc:
//		Processes a Xerces start element event
//
//---------------------------------------------------------------------------
void
CParseHandlerScalarSubPlanTestExpr::StartElement
	(
	const XMLCh* const xmlszUri,
	const XMLCh* const xmlszLocalname,
	const XMLCh* const xmlszQname,
	const Attributes& attrs
	)
{
	if (0 != XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenScalarSubPlanTestExpr), xmlszLocalname))
	{
		// install a scalar element parser for parsing the test expression
		CParseHandlerBase *pphChild = CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenScalar), m_pphm, this);

		m_pphm->ActivateParseHandler(pphChild);

		// store parse handler
		this->Append(pphChild);

		pphChild->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);
	}
}
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerScalarSubPlanParamList::StartElement
//
//	@doc:
//		Processes a Xerces start element event
//
//---------------------------------------------------------------------------
void
CParseHandlerScalarSubPlanParamList::StartElement
	(
	const XMLCh* const xmlszUri,
	const XMLCh* const xmlszLocalname,
	const XMLCh* const xmlszQname,
	const Attributes &attrs
	)
{
	if(0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenScalarSubPlanParamList), xmlszLocalname))
	{
		// we can't have seen a paramlist already
		GPOS_ASSERT(!m_fParamList);
		// start the paramlist
		m_fParamList = true;
	}
	else if(0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenScalarSubPlanParam), xmlszLocalname))
	{
		// we must have seen a paramlist already
		GPOS_ASSERT(m_fParamList);

		// start new param
		CParseHandlerBase *pphParam = CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenScalarSubPlanParam), m_pphm, this);
		m_pphm->ActivateParseHandler(pphParam);

		// store parse handler
		this->Append(pphParam);

		pphParam->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);
	}
	else
	{
		CWStringDynamic *pstr = CDXLUtils::PstrFromXMLCh(m_pphm->Pmm(), xmlszLocalname);
		GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag, pstr->Wsz());
	}
}
Exemplo n.º 18
0
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerSequence::StartElement
//
//	@doc:
//		Invoked by Xerces to process an opening tag
//
//---------------------------------------------------------------------------
void
CParseHandlerSequence::StartElement
	(
	const XMLCh* const xmlszUri,
	const XMLCh* const xmlszLocalname,
	const XMLCh* const xmlszQname,
	const Attributes& attrs
	)
{
	if (!m_fInsideSequence && 0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenPhysicalSequence), xmlszLocalname))
	{
		// new sequence operator
		// parse handler for the proj list
		CParseHandlerBase *pphPrL =
				CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenScalarProjList), m_pphm, this);
		m_pphm->ActivateParseHandler(pphPrL);

		//parse handler for the properties of the operator
		CParseHandlerBase *pphProp =
				CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenProperties), m_pphm, this);
		m_pphm->ActivateParseHandler(pphProp);

		// store child parse handlers in array
		this->Append(pphProp);
		this->Append(pphPrL);
		m_fInsideSequence = true;
	}
	else
	{
		// child of the sequence operator
		CParseHandlerBase *pphChild = CParseHandlerFactory::Pph(m_pmp, xmlszLocalname, m_pphm, this);
		m_pphm->ActivateParseHandler(pphChild);
		this->Append(pphChild);
		pphChild->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);
	}	
}
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerMDGPDBScalarOp::StartElement
//
//	@doc:
//		Invoked by Xerces to process an opening tag
//
//---------------------------------------------------------------------------
void
CParseHandlerMDGPDBScalarOp::StartElement
	(
	const XMLCh* const xmlszUri,
	const XMLCh* const xmlszLocalname,
	const XMLCh* const xmlszQname,
	const Attributes& attrs
	)
{
	if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenGPDBScalarOp), xmlszLocalname))
	{
		// parse operator name
		const XMLCh *xmlszOpName = CDXLOperatorFactory::XmlstrFromAttrs
															(
															attrs,
															EdxltokenName,
															EdxltokenGPDBScalarOp
															);

		CWStringDynamic *pstrOpName = CDXLUtils::PstrFromXMLCh(m_pphm->Pmm(), xmlszOpName);
		
		// create a copy of the string in the CMDName constructor
		m_pmdname = GPOS_NEW(m_pmp) CMDName(m_pmp, pstrOpName);
		
		GPOS_DELETE(pstrOpName);

		// parse metadata id info
		m_pmdid = CDXLOperatorFactory::PmdidFromAttrs
										(
										m_pphm->Pmm(),
										attrs,
										EdxltokenMdid,
										EdxltokenGPDBScalarOp
										);
		
		const XMLCh *xmlszCmpType = CDXLOperatorFactory::XmlstrFromAttrs
									(
									attrs,
									EdxltokenGPDBScalarOpCmpType,
									EdxltokenGPDBScalarOp
									);

		m_ecmpt = CDXLOperatorFactory::Ecmpt(xmlszCmpType);

		// null-returning property is optional
		const XMLCh *xmlszReturnsNullOnNullInput = attrs.getValue(CDXLTokens::XmlstrToken(EdxltokenReturnsNullOnNullInput));
		if (NULL != xmlszReturnsNullOnNullInput)
		{
			m_fReturnsNullOnNullInput = CDXLOperatorFactory::FValueFromAttrs
								(
								m_pphm->Pmm(),
								attrs,
								EdxltokenReturnsNullOnNullInput,
								EdxltokenGPDBScalarOp
								);
		}

	}
	else if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenGPDBScalarOpLeftTypeId), xmlszLocalname))
	{
		// parse left operand's type
		GPOS_ASSERT(NULL != m_pmdname);

		m_pmdidTypeLeft = CDXLOperatorFactory::PmdidFromAttrs
												(
												m_pphm->Pmm(),
												attrs, 
												EdxltokenMdid,
												EdxltokenGPDBScalarOpLeftTypeId
												);
	}
	else if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenGPDBScalarOpRightTypeId), xmlszLocalname))
	{
		// parse right operand's type
		GPOS_ASSERT(NULL != m_pmdname);

		m_pmdidTypeRight = CDXLOperatorFactory::PmdidFromAttrs
													(
													m_pphm->Pmm(),
													attrs,
													EdxltokenMdid,
													EdxltokenGPDBScalarOpRightTypeId
													);
	}
	else if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenGPDBScalarOpResultTypeId), xmlszLocalname))
	{
		// parse result type
		GPOS_ASSERT(NULL != m_pmdname);

		m_pmdidTypeResult = CDXLOperatorFactory::PmdidFromAttrs
													(
													m_pphm->Pmm(),
													attrs,
													EdxltokenMdid,
													EdxltokenGPDBScalarOpResultTypeId
													);
	}
	else if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenGPDBScalarOpFuncId), xmlszLocalname))
	{
		// parse op func id
		GPOS_ASSERT(NULL != m_pmdname);

		m_pmdidFunc = CDXLOperatorFactory::PmdidFromAttrs
												(
												m_pphm->Pmm(),
												attrs, 
												EdxltokenMdid,
												EdxltokenGPDBScalarOpFuncId
												);
	}
	else if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenGPDBScalarOpCommOpId), xmlszLocalname))
	{
		// parse commutator operator
		GPOS_ASSERT(NULL != m_pmdname);

		m_pmdidOpCommute = CDXLOperatorFactory::PmdidFromAttrs
													(
													m_pphm->Pmm(),
													attrs,
													EdxltokenMdid,
													EdxltokenGPDBScalarOpCommOpId
													);
	}
	else if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenGPDBScalarOpInverseOpId), xmlszLocalname))
	{
		// parse inverse operator id
		GPOS_ASSERT(NULL != m_pmdname);

		m_pmdidOpInverse = CDXLOperatorFactory::PmdidFromAttrs
													(
													m_pphm->Pmm(),
													attrs,
													EdxltokenMdid,
													EdxltokenGPDBScalarOpInverseOpId
													);
	}
	else if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenOpClasses), xmlszLocalname))
	{
		// parse handler for operator class list
		CParseHandlerBase *pphOpClassList = CParseHandlerFactory::Pph(m_pmp, CDXLTokens::XmlstrToken(EdxltokenMetadataIdList), m_pphm, this);
		m_pphm->ActivateParseHandler(pphOpClassList);
		this->Append(pphOpClassList);
		pphOpClassList->startElement(xmlszUri, xmlszLocalname, xmlszQname, attrs);
	}
	else
	{
		CWStringDynamic *pstr = CDXLUtils::PstrFromXMLCh(m_pphm->Pmm(), xmlszLocalname);
		GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag, pstr->Wsz());
	}
}
Exemplo n.º 20
0
//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerOptimizerConfig::StartElement
//
//	@doc:
//		Invoked by Xerces to process an opening tag
//
//---------------------------------------------------------------------------
void
CParseHandlerOptimizerConfig::StartElement
	(
	const XMLCh* const element_uri,
	const XMLCh* const element_local_name,
	const XMLCh* const element_qname,
	const Attributes &attrs
	)
{	
	if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenHint), element_local_name))
	{
		// install a parse handler for the hint config
		CParseHandlerBase *pphHint = CParseHandlerFactory::GetParseHandler(m_mp, CDXLTokens::XmlstrToken(EdxltokenHint), m_parse_handler_mgr, this);
		m_parse_handler_mgr->ActivateParseHandler(pphHint);
		pphHint->startElement(element_uri, element_local_name, element_qname, attrs);
		this->Append(pphHint);
		return;

	}
	else if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenCostModelConfig), element_local_name))
	{
		// install a parse handler for the cost model config
		CParseHandlerBase *pphCostModel = CParseHandlerFactory::GetParseHandler(m_mp, CDXLTokens::XmlstrToken(EdxltokenCostModelConfig), m_parse_handler_mgr, this);
		m_parse_handler_mgr->ActivateParseHandler(pphCostModel);
		pphCostModel->startElement(element_uri, element_local_name, element_qname, attrs);
		this->Append(pphCostModel);
		return;

	}
	else if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenTraceFlags), element_local_name))
	{
		// install a parse handler for the trace flags
		CParseHandlerBase *pphTraceFlags = CParseHandlerFactory::GetParseHandler(m_mp, CDXLTokens::XmlstrToken(EdxltokenTraceFlags), m_parse_handler_mgr, this);
		m_parse_handler_mgr->ActivateParseHandler(pphTraceFlags);
		pphTraceFlags->startElement(element_uri, element_local_name, element_qname, attrs);
		this->Append(pphTraceFlags);
		return;

	}
	else if (0 != XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenOptimizerConfig), element_local_name))
	{
		CWStringDynamic *str = CDXLUtils::CreateDynamicStringFromXMLChArray(m_parse_handler_mgr->GetDXLMemoryManager(), element_local_name);
		GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag, str->GetBuffer());
	}

	CParseHandlerBase *pphWindowOids = CParseHandlerFactory::GetParseHandler(m_mp, CDXLTokens::XmlstrToken(EdxltokenWindowOids), m_parse_handler_mgr, this);
	m_parse_handler_mgr->ActivateParseHandler(pphWindowOids);

	// install a parse handler for the CTE configuration
	CParseHandlerBase *pphCTEConfig = CParseHandlerFactory::GetParseHandler(m_mp, CDXLTokens::XmlstrToken(EdxltokenCTEConfig), m_parse_handler_mgr, this);
	m_parse_handler_mgr->ActivateParseHandler(pphCTEConfig);

	// install a parse handler for the statistics configuration
	CParseHandlerBase *pphStatisticsConfig = CParseHandlerFactory::GetParseHandler(m_mp, CDXLTokens::XmlstrToken(EdxltokenStatisticsConfig), m_parse_handler_mgr, this);
	m_parse_handler_mgr->ActivateParseHandler(pphStatisticsConfig);

	// install a parse handler for the enumerator configuration
	CParseHandlerBase *pphEnumeratorConfig = CParseHandlerFactory::GetParseHandler(m_mp, CDXLTokens::XmlstrToken(EdxltokenEnumeratorConfig), m_parse_handler_mgr, this);
	m_parse_handler_mgr->ActivateParseHandler(pphEnumeratorConfig);

	// store parse handlers
	this->Append(pphEnumeratorConfig);
	this->Append(pphStatisticsConfig);
	this->Append(pphCTEConfig);
	this->Append(pphWindowOids);
}