hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vraghava...@apache.org
Subject [1/2] incubator-hawq git commit: HAWQ-764. Remove CTranslatorPlStmtToDXL Deadcode [#119102697]
Date Wed, 22 Jun 2016 17:57:09 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 817249a46 -> 752a98cda


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/752a98cd/src/backend/gpopt/utils/COptTasks.cpp
----------------------------------------------------------------------
diff --git a/src/backend/gpopt/utils/COptTasks.cpp b/src/backend/gpopt/utils/COptTasks.cpp
index 6ff6556..4d6e2f7 100644
--- a/src/backend/gpopt/utils/COptTasks.cpp
+++ b/src/backend/gpopt/utils/COptTasks.cpp
@@ -41,7 +41,6 @@
 #include "gpopt/translate/CTranslatorExprToDXL.h"
 #include "gpopt/translate/CTranslatorUtils.h"
 #include "gpopt/translate/CTranslatorQueryToDXL.h"
-#include "gpopt/translate/CTranslatorPlStmtToDXL.h"
 #include "gpopt/translate/CTranslatorDXLToPlStmt.h"
 #include "gpopt/translate/CTranslatorDXLToQuery.h"
 #include "gpopt/translate/CContextDXLToPlStmt.h"
@@ -1234,64 +1233,6 @@ COptTasks::PvOptimizeMinidumpTask
 	return NULL;
 }
 
-
-//---------------------------------------------------------------------------
-//	@function:
-//		COptTasks::PvDXLFromPlstmtTask
-//
-//	@doc:
-//		task that does the translation from planned stmt to XML
-//
-//---------------------------------------------------------------------------
-void*
-COptTasks::PvDXLFromPlstmtTask
-	(
-	void *pv
-	)
-{
-	GPOS_ASSERT(NULL != pv);
-
-	SOptContext *poctx = SOptContext::PoptctxtConvert(pv);
-
-	GPOS_ASSERT(NULL != poctx->m_pplstmt);
-	GPOS_ASSERT(NULL == poctx->m_szPlanDXL);
-
-	AUTO_MEM_POOL(amp);
-	IMemoryPool *pmp = amp.Pmp();
-
-	CIdGenerator idgtor(1);
-
-	// relcache MD provider
-	CMDProviderRelcache *pmdpr = GPOS_NEW(pmp) CMDProviderRelcache(pmp);
-
-	{
-		CAutoMDAccessor amda(pmp, pmdpr, sysidDefault);
-
-		CMappingParamIdScalarId mapps(pmp);
-
-		CTranslatorPlStmtToDXL tplstmtdxl(pmp, amda.Pmda(), &idgtor, (PlannedStmt*) poctx->m_pplstmt,
&mapps);
-		CDXLNode *pdxlnPlan = tplstmtdxl.PdxlnFromPlstmt();
-
-		GPOS_ASSERT(NULL != pdxlnPlan);
-
-		CWStringDynamic str(pmp);
-		COstreamString oss(&str);
-
-		// get chosen plan number
-		ULLONG ullPlanId =  (ULLONG) optimizer_plan_id;
-		CWStringDynamic *pstrDXL = CDXLUtils::PstrSerializePlan(pmp, pdxlnPlan, ullPlanId, 0 /*ullPlanSpaceSize*/,
true /*fSerializeHeaderFooter*/, true /*fIndent*/);
-
-		poctx->m_szPlanDXL = SzFromWsz(pstrDXL->Wsz());
-
-		// cleanup
-		GPOS_DELETE(pstrDXL);
-		pdxlnPlan->Release();
-	}
-
-	return NULL;
-}
-
-
 //---------------------------------------------------------------------------
 //	@function:
 //		COptTasks::PvPlstmtFromDXLTask
@@ -1773,34 +1714,6 @@ COptTasks::SzDXL
 
 //---------------------------------------------------------------------------
 //	@function:
-//		COptTasks::SzDXL
-//
-//	@doc:
-//		serializes planned stmt to DXL
-//
-//---------------------------------------------------------------------------
-char *
-COptTasks::SzDXL
-	(
-	PlannedStmt *pplstmt
-	)
-{
-	Assert(pplstmt);
-
-	SOptContext octx;
-	octx.m_pplstmt = pplstmt;
-	octx.m_fSerializePlanDXL = true;
-	Execute(&PvDXLFromPlstmtTask, &octx);
-
-	// clean up context
-	octx.Free(octx.epinPlStmt, octx.epinPlanDXL);
-
-	return octx.m_szPlanDXL;
-}
-
-
-//---------------------------------------------------------------------------
-//	@function:
 //		COptTasks::PqueryFromXML
 //
 //	@doc:

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/752a98cd/src/backend/gpopt/utils/funcs.cpp
----------------------------------------------------------------------
diff --git a/src/backend/gpopt/utils/funcs.cpp b/src/backend/gpopt/utils/funcs.cpp
index c36a7e3..dbecb60 100644
--- a/src/backend/gpopt/utils/funcs.cpp
+++ b/src/backend/gpopt/utils/funcs.cpp
@@ -64,8 +64,6 @@ PG_FUNCTION_INFO_V1(DumpPlan);
 PG_FUNCTION_INFO_V1(RestorePlan);
 PG_FUNCTION_INFO_V1(DumpPlanToFile);
 PG_FUNCTION_INFO_V1(RestorePlanFromFile);
-PG_FUNCTION_INFO_V1(DumpPlanDXL);
-PG_FUNCTION_INFO_V1(DumpPlanToDXLFile);
 PG_FUNCTION_INFO_V1(RestorePlanDXL);
 PG_FUNCTION_INFO_V1(RestorePlanFromDXLFile);
 PG_FUNCTION_INFO_V1(DumpMDObjDXL);
@@ -381,37 +379,6 @@ DumpQueryToFile(PG_FUNCTION_ARGS)
 
 //---------------------------------------------------------------------------
 //	@function:
-//		DumpPlanDXL
-//
-//	@doc:
-//		Plan a query and dump out plan as xml text.
-// 		Input: sql query text
-// 		Output: plan in dxl
-//
-//---------------------------------------------------------------------------
-
-extern "C" {
-Datum
-DumpPlanDXL(PG_FUNCTION_ARGS)
-{
-	char *szSqlText = textToString(PG_GETARG_TEXT_P(0));
-
-	PlannedStmt *pplstmt = planQuery(szSqlText);
-
-	Assert(pplstmt);
-
-	char *szXmlString = COptTasks::SzDXL(pplstmt);
-	if (NULL == szXmlString)
-	{
-		elog(ERROR, "Error translating plan to DXL");
-	}
-
-	PG_RETURN_TEXT_P(stringToText(szXmlString));
-}
-}
-
-//---------------------------------------------------------------------------
-//	@function:
 //		DumpQueryDXL
 //
 //	@doc:
@@ -760,39 +727,6 @@ RestorePlanFromDXLFile(PG_FUNCTION_ARGS)
 
 //---------------------------------------------------------------------------
 //	@function:
-//		DumpPlanToDXLFile
-//
-//	@doc:
-//
-//
-//---------------------------------------------------------------------------
-
-extern "C" {
-Datum
-DumpPlanToDXLFile(PG_FUNCTION_ARGS)
-{
-	char *szSql = textToString(PG_GETARG_TEXT_P(0));
-	char *szFilename = textToString(PG_GETARG_TEXT_P(1));
-
-	PlannedStmt *pplstmt = planQuery(szSql);
-	Assert(pplstmt);
-
-	char *szXmlString = COptTasks::SzDXL(pplstmt);
-
-	int iLen = (int) gpos::clib::UlStrLen(szXmlString);
-
-	CFileWriter fw;
-	fw.Open(szFilename, S_IRUSR | S_IWUSR);
-	fw.Write(reinterpret_cast<const BYTE*>(szXmlString), iLen + 1);
-	fw.Close();
-
-	PG_RETURN_INT32(iLen);
-
-}
-}
-
-//---------------------------------------------------------------------------
-//	@function:
 //		DumpMDObjDXL
 //
 //	@doc:

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/752a98cd/src/backend/gpopt/utils/load.sql
----------------------------------------------------------------------
diff --git a/src/backend/gpopt/utils/load.sql b/src/backend/gpopt/utils/load.sql
index 90cf083..bfe7d67 100644
--- a/src/backend/gpopt/utils/load.sql
+++ b/src/backend/gpopt/utils/load.sql
@@ -14,12 +14,6 @@ language c strict;
 create function gpoptutils.RestorePlanFromFile(text) returns text as '/Users/solimm1/greenplum-db-devel/lib/libgpoptudf.dylib',
'RestorePlanFromFile'
 language c strict;
 
-create function gpoptutils.DumpPlanDXL(text) returns text as '/Users/solimm1/greenplum-db-devel/lib/libgpoptudf.dylib',
'DumpPlanDXL'
-language c strict;
-
-create function gpoptutils.DumpPlanToDXLFile(text, text) returns int as '/Users/solimm1/greenplum-db-devel/lib/libgpoptudf.dylib',
'DumpPlanToDXLFile'
-language c strict;
-
 create function gpoptutils.RestorePlanDXL(text) returns text as '/Users/solimm1/greenplum-db-devel/lib/libgpoptudf.dylib',
'RestorePlanDXL' language c strict;
 
 create function gpoptutils.RestorePlanFromDXLFile(text) returns text as '/Users/solimm1/greenplum-db-devel/lib/libgpoptudf.dylib',
'RestorePlanFromDXLFile' language c strict;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/752a98cd/src/include/gpopt/translate/CTranslatorPlStmtToDXL.h
----------------------------------------------------------------------
diff --git a/src/include/gpopt/translate/CTranslatorPlStmtToDXL.h b/src/include/gpopt/translate/CTranslatorPlStmtToDXL.h
deleted file mode 100644
index 09b16d6..0000000
--- a/src/include/gpopt/translate/CTranslatorPlStmtToDXL.h
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-//---------------------------------------------------------------------------
-//	@filename:
-//		CTranslatorPlStmtToDXL.h
-//
-//	@doc:
-//		Class providing methods for translating GPDB's PlannedStmt into DXL Tree
-//
-//	@test:
-//
-//
-//---------------------------------------------------------------------------
-
-#ifndef GPDXL_CTranslatorPlStmtToDXL_H
-#define GPDXL_CTranslatorPlStmtToDXL_H
-
-#include "gpopt/translate/CTranslatorScalarToDXL.h"
-#include "gpopt/translate/CMappingParamIdScalarId.h"
-
-#include "gpos/base.h"
-
-#include "naucrates/dxl/operators/dxlops.h"
-#include "naucrates/dxl/CIdGenerator.h"
-
-#include "naucrates/md/IMDIndex.h"
-
-
-// fwd declarations
-namespace gpopt
-{
-	class CMDAccessor;
-}
-
-struct Const;
-struct List;
-struct PlannedStmt;
-struct Scan;
-struct HashJoin;
-struct Hash;
-struct RangeTblEntry;
-struct NestLoop;
-struct MergeJoin;
-struct Motion;
-struct Limit;
-struct Agg;
-struct Append;
-struct Sort;
-struct SubqueryScan;
-struct Result;
-struct Unique;
-struct Material;
-struct ShareInputScan;
-struct IndexScan;
-
-typedef OpExpr DistintExpr;
-typedef Scan SeqScan;
-
-namespace gpdxl
-{
-	using namespace gpopt;
-
-	class CDXLNode;
-	class CMappingVarColId;
-
-	//---------------------------------------------------------------------------
-	//	@class:
-	//		CTranslatorPlStmtToDXL
-	//
-	//	@doc:
-	//		Class providing methods for translating GPDB's PlannedStmt into DXL Tree.
-	//
-	//---------------------------------------------------------------------------
-	class CTranslatorPlStmtToDXL
-	{
-		// shorthand for functions for translating GPDB expressions into DXL nodes
-		typedef CDXLNode * (CTranslatorPlStmtToDXL::*PfPdxln)(const Plan *pplan);
-
-		private:
-
-			// pair of node tag and translator function
-			struct STranslatorElem
-			{
-				NodeTag ent;
-				PfPdxln pf;
-			};
-
-	 	 	// memory pool
-			IMemoryPool *m_pmp;
-
-			// meta data accessor
-			CMDAccessor *m_pmda;
-
-			// counter for generating unique column ids
-			CIdGenerator *m_pidgtor;
-
-			// planned stmt being translated
-			PlannedStmt *m_pplstmt;
-
-			// translator for scalar expressions
-			CTranslatorScalarToDXL *m_psctranslator;
-
-			// project lists of already translated shared scans indexed by the shared scan id
-			HMUlPdxln *m_phmuldxlnSharedScanProjLists;
-
-			// mapping from param id -> scalar id in subplans
-			CMappingParamIdScalarId *m_pparammapping;
-
-			// private copy ctor
-			CTranslatorPlStmtToDXL(const CTranslatorPlStmtToDXL&);
-
-			// create DXL table scan node from a scan plan node
-			CDXLNode *PdxlnTblScanFromPlan(const Plan *pplan);
-
-			// create DXL physical TVF node from a FunctionScan plan node
-			CDXLNode *PdxlnFunctionScanFromPlan(const Plan *pplan);
-
-			// create DXL physical result node from a folded function expression
-			CDXLNode *PdxlnResultFromFoldedFuncExpr
-				(
-				const Expr *pexpr,
-				CWStringDynamic *pstrAlias,
-				CDXLPhysicalProperties *pdxlprop,
-				CMappingVarColId *pmapvarcolid
-				);
-
-			// create DXL index scan node from an index plan node
-			CDXLNode *PdxlnIndexScanFromPlan(const Plan *pplan);
-
-			// create a DXL index (only) scan node from a GPDB index (only) scan node.
-			CDXLNode *PdxlnIndexScanFromGPDBIndexScan(const IndexScan *pindexscan, BOOL fIndexOnlyScan);
-
-			// create DXL hash join node from a hash join plan node
-			CDXLNode *PdxlnHashjoinFromPlan(const Plan *pplan);
-
-			// create DXL hash node from a hash plan node
-			CDXLNode *PdxlnHashFromPlan(const Plan *pplan);
-
-			// create DXL nested loop join node from a nested loop join plan node
-			CDXLNode *PdxlnNLJoinFromPlan(const Plan *pplan);
-
-			// create DXL merge join node from a merge join plan node
-			CDXLNode *PdxlnMergeJoinFromPlan(const Plan *pplan);
-
-			// create DXL result node from a result plan node
-			CDXLNode *PdxlnResultFromPlan(const Plan *pplan);
-
-			// create DXL Limit node from a Limit plan node
-			CDXLNode *PdxlnLimitFromPlan(const Plan *pplan);
-
-			// create DXL redistribute motion node from a motion plan node
-			CDXLNode *PdxlnMotionFromPlan(const Plan *pplan);
-
-			// create DXL aggregate node from an Agg plan node
-			CDXLNode *PdxlnAggFromPlan(const Plan *pplan);
-
-			// create DXL window node from an window plan node
-			CDXLNode *PdxlnWindowFromPlan(const Plan *pplan);
-
-            // create DXL aggregate node from a Unique plan node
-            CDXLNode *PdxlnUniqueFromPlan(const Plan *pplan);
-
-			// create DXL sort node from a Sort plan node
-			CDXLNode *PdxlnSortFromPlan(const Plan *pplan);
-
-			CDXLNode *PdxlnSubqueryScanFromPlan(const Plan *pplan);
-
-			// create DXL append node from an Append plan node
-			CDXLNode *PdxlnAppendFromPlan(const Plan *pplan);
-
-			// create DXL shared scan node from a ShareInputScan plan node
-			CDXLNode *PdxlnSharedScanFromPlan(const Plan *pplan);
-
-			// create DXL materialize node from a Material plan node
-			CDXLNode *PdxlnMaterializeFromPlan(const Plan *pplan);
-
-			// create DXL sequence node from a Sequence plan node
-			CDXLNode *PdxlnSequence(const Plan *pplan);
-
-			// create DXL dynamic table scan node from the corresponding plan node
-			CDXLNode *PdxlnDynamicTableScan(const Plan *pplan);
-
-			// create a DXL table descriptor from a range table entry
-			CDXLTableDescr *Pdxltabdesc(const RangeTblEntry *prte, const Scan *psscan);
-
-			// create a DXL projection list of a scan node from GPDB target list
-			CDXLNode *PdxlnPrLFromTL
-				(
-				List *plTargetList,
-				CMappingVarColId *pmapvarcolid
-				);
-
-			// extract cost estimates from Plan structures and store them in a
-			// DXL properties container
-			CDXLPhysicalProperties *PdxlpropFromPlan(const Plan *pplan);
-
-			// translate the hash expression list for a redistribute motion node into a DXL node
-			CDXLNode *PdxlnHashExprLFromList(List *, List *, const CDXLNode *);
-
-			// translate the sorting column list for a sort or motion node into a DXL node
-			CDXLNode *PdxlnSortingColListFromPlan(AttrNumber *patnoSortColIds, OID *poidSortOpIds,
ULONG ulNumCols, const CDXLNode *pdxlnPrL);
-
-			// translate target and qual lists into DXL project list and filter,
-			// respectively
-			void TranslateTListAndQual
-				(
-				List *plTargetList,
-				List *plQual,
-				ULONG ulRTEIndex,
-				const CDXLTableDescr *pdxltabdesc,
-				const IMDIndex *pmdindex,
-				const CDXLNode *pdxlnPrLLeft,
-				const CDXLNode *pdxlnPrLRight,
-				CDXLNode **ppdxlnPrLOut,
-				CDXLNode **ppdxlnFilterOut
-				);
-
-			// populate the input and output segments id lists from a Motion node
-			void TranslateMotionSegmentInfo
-				(
-				const Motion *pmotion,
-				DrgPi *pdrgpiInputSegIds,
-				DrgPi *pdrgpiOutputSegIds
-				);
-
-			// creates a DXL shared scan spool info structure from a GPDB shared scan node
-			CDXLSpoolInfo *PspoolinfoFromSharedScan(const ShareInputScan *pshscan);
-
-		public:
-			// ctor/dtor
-			CTranslatorPlStmtToDXL
-				(
-				IMemoryPool *pmp,
-				CMDAccessor *pmda,
-				CIdGenerator *pulIdGenerator,
-				PlannedStmt *pplstmt,
-				CMappingParamIdScalarId *pmapps
-				);
-
-			~CTranslatorPlStmtToDXL();
-
-			// main translation routine for PlannedStmt -> DXL tree
-			CDXLNode *PdxlnFromPlstmt();
-
-			// translates a PlannedStmt node into a DXL tree
-			CDXLNode *PdxlnFromPlan(const Plan *pplan);
-
-	};
-}
-
-#endif // !GPDXL_CTranslatorPlStmtToDXL_H
-
-// EOF

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/752a98cd/src/include/gpopt/utils/COptTasks.h
----------------------------------------------------------------------
diff --git a/src/include/gpopt/utils/COptTasks.h b/src/include/gpopt/utils/COptTasks.h
index cad5e29..a62155f 100644
--- a/src/include/gpopt/utils/COptTasks.h
+++ b/src/include/gpopt/utils/COptTasks.h
@@ -179,10 +179,6 @@ class COptTasks
 		static
 		void Execute ( void *(*pfunc) (void *), void *pfuncArg);
 
-		// task that does the translation from planned stmt to XML
-		static
-		void* PvDXLFromPlstmtTask(void *pv);
-
 		// task that does the translation from xml to dxl to pplstmt
 		static
 		void* PvPlstmtFromDXLTask(void *pv);
@@ -285,10 +281,6 @@ class COptTasks
 		static
 		char *SzDXL(Query *pquery);
 
-		// convert planned statement to DXL to xml string.
-		static
-		char *SzDXL(PlannedStmt *pplstmt);
-
 		// convert xml string to DXL and to Query
 		static
 		Query *PqueryFromXML(char *szXmlString);


Mime
View raw message