void OutDistributedPlan(OUTFUNC_ARGS) { WRITE_LOCALS(DistributedPlan); WRITE_NODE_TYPE("DISTRIBUTEDPLAN"); WRITE_UINT64_FIELD(planId); WRITE_INT_FIELD(operation); WRITE_BOOL_FIELD(hasReturning); WRITE_NODE_FIELD(workerJob); WRITE_NODE_FIELD(masterQuery); WRITE_BOOL_FIELD(routerExecutable); WRITE_UINT64_FIELD(queryId); WRITE_NODE_FIELD(relationIdList); WRITE_NODE_FIELD(insertSelectSubquery); WRITE_NODE_FIELD(insertTargetList); WRITE_OID_FIELD(targetRelationId); WRITE_NODE_FIELD(subPlanList); WRITE_NODE_FIELD(planningError); }
static void _outIndexOptInfo(StringInfo str, IndexOptInfo *node) { WRITE_NODE_TYPE("INDEXOPTINFO"); /* NB: this isn't a complete set of fields */ WRITE_OID_FIELD(indexoid); /* Do NOT print rel field, else infinite recursion */ WRITE_UINT_FIELD(pages); WRITE_FLOAT_FIELD(tuples, "%.0f"); WRITE_INT_FIELD(ncolumns); WRITE_INT_ARRAY(opfamily, ncolumns, int); WRITE_INT_ARRAY(indexkeys, ncolumns, int); WRITE_INT_ARRAY(ordering, ncolumns, int); WRITE_OID_FIELD(relam); WRITE_OID_FIELD(amcostestimate); WRITE_NODE_FIELD(indexprs); WRITE_NODE_FIELD(indpred); WRITE_BOOL_FIELD(predOK); WRITE_BOOL_FIELD(unique); WRITE_BOOL_FIELD(amoptionalkey); WRITE_BOOL_FIELD(cdb_default_stats_used); }
static void _outAgg(StringInfo str, Agg *node) { WRITE_NODE_TYPE("AGG"); _outPlanInfo(str, (Plan *) node); WRITE_ENUM_FIELD(aggstrategy, AggStrategy); WRITE_INT_FIELD(numCols); WRITE_INT_ARRAY(grpColIdx, numCols, AttrNumber); if (print_variable_fields) { WRITE_LONG_FIELD(numGroups); WRITE_INT_FIELD(transSpace); } WRITE_INT_FIELD(numNullCols); WRITE_UINT64_FIELD(inputGrouping); WRITE_UINT64_FIELD(grouping); WRITE_BOOL_FIELD(inputHasGrouping); WRITE_INT_FIELD(rollupGSTimes); WRITE_BOOL_FIELD(lastAgg); WRITE_BOOL_FIELD(streaming); }
static void _outCreateStmt(StringInfo str, CreateStmt *node) { WRITE_NODE_TYPE("CREATESTMT"); WRITE_NODE_FIELD(relation); WRITE_NODE_FIELD(tableElts); WRITE_NODE_FIELD(inhRelations); WRITE_NODE_FIELD(inhOids); WRITE_INT_FIELD(parentOidCount); WRITE_NODE_FIELD(constraints); WRITE_NODE_FIELD(options); WRITE_ENUM_FIELD(oncommit, OnCommitAction); WRITE_STRING_FIELD(tablespacename); WRITE_NODE_FIELD(distributedBy); WRITE_CHAR_FIELD(relKind); WRITE_CHAR_FIELD(relStorage); /* policy omitted */ /* postCreate - for analysis, QD only */ /* deferredStmts - for analysis, QD only */ WRITE_BOOL_FIELD(is_part_child); WRITE_BOOL_FIELD(is_add_part); WRITE_BOOL_FIELD(is_split_part); WRITE_OID_FIELD(ownerid); WRITE_BOOL_FIELD(buildAoBlkdir); WRITE_NODE_FIELD(attr_encodings); }
void OutTask(OUTFUNC_ARGS) { WRITE_LOCALS(Task); WRITE_NODE_TYPE("TASK"); WRITE_ENUM_FIELD(taskType, TaskType); WRITE_UINT64_FIELD(jobId); WRITE_UINT_FIELD(taskId); WRITE_STRING_FIELD(queryString); WRITE_UINT64_FIELD(anchorShardId); WRITE_NODE_FIELD(taskPlacementList); WRITE_NODE_FIELD(dependedTaskList); WRITE_UINT_FIELD(partitionId); WRITE_UINT_FIELD(upstreamTaskId); WRITE_NODE_FIELD(shardInterval); WRITE_BOOL_FIELD(assignmentConstrained); WRITE_NODE_FIELD(taskExecution); WRITE_BOOL_FIELD(upsertQuery); WRITE_CHAR_FIELD(replicationModel); WRITE_BOOL_FIELD(modifyWithSubquery); WRITE_NODE_FIELD(relationShardList); WRITE_NODE_FIELD(relationRowLockList); WRITE_NODE_FIELD(rowValuesLists); }
void OutShardInterval(OUTFUNC_ARGS) { WRITE_LOCALS(ShardInterval); WRITE_NODE_TYPE("SHARDINTERVAL"); WRITE_OID_FIELD(relationId); WRITE_CHAR_FIELD(storageType); WRITE_OID_FIELD(valueTypeId); WRITE_INT_FIELD(valueTypeLen); WRITE_BOOL_FIELD(valueByVal); WRITE_BOOL_FIELD(minValueExists); WRITE_BOOL_FIELD(maxValueExists); appendStringInfoString(str, " :minValue "); if (!node->minValueExists) appendStringInfoString(str, "<>"); else outDatum(str, node->minValue, node->valueTypeLen, node->valueByVal); appendStringInfoString(str, " :maxValue "); if (!node->maxValueExists) appendStringInfoString(str, "<>"); else outDatum(str, node->maxValue, node->valueTypeLen, node->valueByVal); WRITE_UINT64_FIELD(shardId); WRITE_INT_FIELD(shardIndex); }
static void _outRangeTblEntry(StringInfo str, RangeTblEntry *node) { WRITE_NODE_TYPE("RTE"); /* put alias + eref first to make dump more legible */ WRITE_NODE_FIELD(alias); WRITE_NODE_FIELD(eref); WRITE_ENUM_FIELD(rtekind, RTEKind); switch (node->rtekind) { case RTE_RELATION: case RTE_SPECIAL: WRITE_OID_FIELD(relid); break; case RTE_SUBQUERY: WRITE_NODE_FIELD(subquery); break; case RTE_CTE: WRITE_STRING_FIELD(ctename); WRITE_INT_FIELD(ctelevelsup); WRITE_BOOL_FIELD(self_reference); WRITE_NODE_FIELD(ctecoltypes); WRITE_NODE_FIELD(ctecoltypmods); break; case RTE_FUNCTION: WRITE_NODE_FIELD(funcexpr); WRITE_NODE_FIELD(funccoltypes); WRITE_NODE_FIELD(funccoltypmods); break; case RTE_TABLEFUNCTION: WRITE_NODE_FIELD(subquery); WRITE_NODE_FIELD(funcexpr); WRITE_NODE_FIELD(funccoltypes); WRITE_NODE_FIELD(funccoltypmods); WRITE_BYTEA_FIELD(funcuserdata); break; case RTE_VALUES: WRITE_NODE_FIELD(values_lists); break; case RTE_JOIN: WRITE_ENUM_FIELD(jointype, JoinType); WRITE_NODE_FIELD(joinaliasvars); break; case RTE_VOID: /*CDB*/ break; default: elog(ERROR, "unrecognized RTE kind: %d", (int) node->rtekind); break; } WRITE_BOOL_FIELD(inh); WRITE_BOOL_FIELD(inFromCl); WRITE_UINT_FIELD(requiredPerms); WRITE_OID_FIELD(checkAsUser); WRITE_BOOL_FIELD(forceDistRandom); }
static void _outNestLoop(StringInfo str, NestLoop *node) { WRITE_NODE_TYPE("NESTLOOP"); _outJoinPlanInfo(str, (Join *) node); WRITE_BOOL_FIELD(outernotreferencedbyinner); /*CDB*/ WRITE_BOOL_FIELD(shared_outer); WRITE_BOOL_FIELD(singleton_outer); /*CDB-OLAP*/ }
static void set_T_MergeAppendPath(DebugGraph *graph, DebugNode *n, PlannerInfo *root, Node *node) { MergePath *actual_node = (MergePath *) node; set_T_Path(graph, n, root, node); /* inheritance */ WRITE_BOOL_FIELD(outersortkeys); WRITE_BOOL_FIELD(innersortkeys); WRITE_BOOL_FIELD(materialize_inner); }
static void _outFuncExpr(StringInfo str, FuncExpr *node) { WRITE_NODE_TYPE("FUNCEXPR"); WRITE_OID_FIELD(funcid); WRITE_OID_FIELD(funcresulttype); WRITE_BOOL_FIELD(funcretset); WRITE_ENUM_FIELD(funcformat, CoercionForm); WRITE_NODE_FIELD(args); WRITE_BOOL_FIELD(is_tablefunc); }
static void OutJobFields(StringInfo str, const Job *node) { WRITE_UINT64_FIELD(jobId); WRITE_NODE_FIELD(jobQuery); WRITE_NODE_FIELD(taskList); WRITE_NODE_FIELD(dependedJobList); WRITE_BOOL_FIELD(subqueryPushdown); WRITE_BOOL_FIELD(requiresMasterEvaluation); WRITE_BOOL_FIELD(deferredPruning); WRITE_NODE_FIELD(partitionKeyValue); }
static void _outConst(StringInfo str, Const *node) { WRITE_NODE_TYPE("CONST"); WRITE_OID_FIELD(consttype); WRITE_INT_FIELD(constlen); WRITE_BOOL_FIELD(constbyval); WRITE_BOOL_FIELD(constisnull); if (!node->constisnull) _outDatum(str, node->constvalue, node->constlen, node->constbyval); }
static void _outTypeName(StringInfo str, TypeName *node) { WRITE_NODE_TYPE("TYPENAME"); WRITE_NODE_FIELD(names); WRITE_OID_FIELD(typid); WRITE_BOOL_FIELD(timezone); WRITE_BOOL_FIELD(setof); WRITE_BOOL_FIELD(pct_type); WRITE_INT_FIELD(typmod); WRITE_NODE_FIELD(arrayBounds); WRITE_INT_FIELD(location); }
static void _outAggref(StringInfo str, Aggref *node) { WRITE_NODE_TYPE("AGGREF"); WRITE_OID_FIELD(aggfnoid); WRITE_OID_FIELD(aggtype); WRITE_NODE_FIELD(args); WRITE_UINT_FIELD(agglevelsup); WRITE_BOOL_FIELD(aggstar); WRITE_BOOL_FIELD(aggdistinct); WRITE_ENUM_FIELD(aggstage, AggStage); WRITE_NODE_FIELD(aggorder); }
static void _outMotion(StringInfo str, Motion *node) { WRITE_NODE_TYPE("MOTION"); WRITE_INT_FIELD(motionID); WRITE_ENUM_FIELD(motionType, MotionType); WRITE_BOOL_FIELD(sendSorted); WRITE_NODE_FIELD(hashExpr); WRITE_NODE_FIELD(hashDataTypes); WRITE_INT_FIELD(numOutputSegs); WRITE_INT_ARRAY(outputSegIdx, node->numOutputSegs, int); WRITE_INT_FIELD(numSortCols); WRITE_INT_ARRAY(sortColIdx, node->numSortCols, AttrNumber); WRITE_OID_ARRAY(sortOperators, node->numSortCols); WRITE_BOOL_ARRAY(nullsFirst, node->numSortCols); WRITE_INT_FIELD(segidColIdx); _outPlanInfo(str, (Plan *) node); }
static void _outColumnDef(StringInfo str, ColumnDef *node) { WRITE_NODE_TYPE("COLUMNDEF"); WRITE_STRING_FIELD(colname); WRITE_NODE_FIELD(typname); WRITE_INT_FIELD(inhcount); WRITE_BOOL_FIELD(is_local); WRITE_BOOL_FIELD(is_not_null); WRITE_INT_FIELD(attnum); WRITE_NODE_FIELD(raw_default); WRITE_STRING_FIELD(cooked_default); WRITE_NODE_FIELD(constraints); WRITE_NODE_FIELD(encoding); }
/* * print the basic stuff of all nodes that inherit from Plan */ static void _outPlanInfo(StringInfo str, Plan *node) { WRITE_INT_FIELD(plan_node_id); WRITE_INT_FIELD(plan_parent_node_id); WRITE_FLOAT_FIELD(startup_cost, "%.2f"); WRITE_FLOAT_FIELD(total_cost, "%.2f"); WRITE_FLOAT_FIELD(plan_rows, "%.0f"); WRITE_INT_FIELD(plan_width); WRITE_NODE_FIELD(targetlist); WRITE_NODE_FIELD(qual); WRITE_BITMAPSET_FIELD(extParam); WRITE_BITMAPSET_FIELD(allParam); WRITE_NODE_FIELD(flow); WRITE_INT_FIELD(dispatch); WRITE_BOOL_FIELD(directDispatch.isDirectDispatch); WRITE_NODE_FIELD(directDispatch.contentIds); WRITE_INT_FIELD(nMotionNodes); WRITE_INT_FIELD(nInitPlans); WRITE_NODE_FIELD(sliceTable); WRITE_NODE_FIELD(lefttree); WRITE_NODE_FIELD(righttree); WRITE_NODE_FIELD(initPlan); WRITE_UINT64_FIELD(operatorMemKB); }
static void _outSort(StringInfo str, Sort *node) { WRITE_NODE_TYPE("SORT"); _outPlanInfo(str, (Plan *) node); WRITE_INT_FIELD(numCols); WRITE_INT_ARRAY(sortColIdx, numCols, AttrNumber); WRITE_OID_ARRAY(sortOperators, numCols); /* CDB */ WRITE_NODE_FIELD(limitOffset); WRITE_NODE_FIELD(limitCount); WRITE_BOOL_FIELD(noduplicates); WRITE_ENUM_FIELD(share_type, ShareType); WRITE_INT_FIELD(share_id); WRITE_INT_FIELD(driver_slice); WRITE_INT_FIELD(nsharer); WRITE_INT_FIELD(nsharer_xslice); }
static void set_T_IndexOptInfo(DebugGraph *graph, DebugNode *n, PlannerInfo *root, Node *node) { IndexOptInfo *actual_node = (IndexOptInfo*) node; /* NB: this isn't a complete set of fields */ WRITE_OID_FIELD(indexoid); WRITE_NODE_FIELD(rel); WRITE_UINT_FIELD(indexoid); newDebugEdgeByNode(graph, n, getTablespace(graph, actual_node->reltablespace), "reltablespace"); WRITE_UINT_FIELD(pages); WRITE_FLOAT_FIELD(tuples, "%lf"); # if PG_VERSION_NUM/100 >= 903 WRITE_INT_FIELD(tree_height); # endif WRITE_INT_FIELD(ncolumns); WRITE_OID_FIELD(relam); WRITE_UINT_FIELD(amcostestimate); //List *indpred; /* predicate if a partial index, else NIL */ //List *indextlist; /* targetlist representing index columns */ WRITE_BOOL_FIELD(reverse_sort); WRITE_BOOL_FIELD(nulls_first); WRITE_BOOL_FIELD(predOK); WRITE_BOOL_FIELD(unique); WRITE_BOOL_FIELD(immediate); WRITE_BOOL_FIELD(hypothetical); WRITE_BOOL_FIELD(canreturn); }
static void _outQuery(StringInfo str, Query *node) { WRITE_NODE_TYPE("QUERY"); WRITE_ENUM_FIELD(commandType, CmdType); WRITE_ENUM_FIELD(querySource, QuerySource); WRITE_BOOL_FIELD(canSetTag); WRITE_NODE_FIELD(utilityStmt); WRITE_INT_FIELD(resultRelation); WRITE_NODE_FIELD(intoClause); WRITE_BOOL_FIELD(hasAggs); WRITE_BOOL_FIELD(hasWindFuncs); WRITE_BOOL_FIELD(hasSubLinks); WRITE_BOOL_FIELD(hasDynamicFunctions); WRITE_NODE_FIELD(rtable); WRITE_NODE_FIELD(jointree); WRITE_NODE_FIELD(targetList); WRITE_NODE_FIELD(returningList); WRITE_NODE_FIELD(groupClause); WRITE_NODE_FIELD(havingQual); WRITE_NODE_FIELD(windowClause); WRITE_NODE_FIELD(distinctClause); WRITE_NODE_FIELD(sortClause); WRITE_NODE_FIELD(scatterClause); WRITE_NODE_FIELD(cteList); WRITE_BOOL_FIELD(hasRecursive); WRITE_BOOL_FIELD(hasModifyingCTE); WRITE_NODE_FIELD(limitOffset); WRITE_NODE_FIELD(limitCount); WRITE_NODE_FIELD(rowMarks); WRITE_NODE_FIELD(setOperations); /* Don't serialize policy */ }
static void _outCreateExtensionStmt(StringInfo str, CreateExtensionStmt *node) { WRITE_NODE_TYPE("CREATEEXTENSIONSTMT"); WRITE_STRING_FIELD(extname); WRITE_BOOL_FIELD(if_not_exists); WRITE_NODE_FIELD(options); WRITE_ENUM_FIELD(create_ext_state, CreateExtensionState); }
static void _outPartitionSpec(StringInfo str, PartitionSpec *node) { WRITE_NODE_TYPE("PARTITIONSPEC"); WRITE_NODE_FIELD(partElem); WRITE_NODE_FIELD(subSpec); WRITE_BOOL_FIELD(istemplate); WRITE_INT_FIELD(location); WRITE_NODE_FIELD(enc_clauses); }
static void _outOuterJoinInfo(StringInfo str, OuterJoinInfo *node) { WRITE_NODE_TYPE("OUTERJOININFO"); WRITE_BITMAPSET_FIELD(min_lefthand); WRITE_BITMAPSET_FIELD(min_righthand); WRITE_ENUM_FIELD(join_type, JoinType); WRITE_BOOL_FIELD(lhs_strict); }
static void _outPlannedStmt(StringInfo str, PlannedStmt *node) { WRITE_NODE_TYPE("PLANNEDSTMT"); WRITE_ENUM_FIELD(commandType, CmdType); WRITE_ENUM_FIELD(planGen, PlanGenerator); WRITE_BOOL_FIELD(canSetTag); WRITE_BOOL_FIELD(transientPlan); WRITE_NODE_FIELD(planTree); WRITE_NODE_FIELD(rtable); WRITE_NODE_FIELD(resultRelations); WRITE_NODE_FIELD(utilityStmt); WRITE_NODE_FIELD(intoClause); WRITE_NODE_FIELD(subplans); WRITE_BITMAPSET_FIELD(rewindPlanIDs); WRITE_NODE_FIELD(returningLists); WRITE_NODE_FIELD(result_partitions); WRITE_NODE_FIELD(result_aosegnos); WRITE_NODE_FIELD(queryPartOids); WRITE_NODE_FIELD(queryPartsMetadata); WRITE_NODE_FIELD(numSelectorsPerScanId); WRITE_NODE_FIELD(rowMarks); WRITE_NODE_FIELD(relationOids); /* * Don't serialize invalItems. The TIDs of the invalidated items wouldn't * make sense in segments. */ WRITE_INT_FIELD(nParamExec); WRITE_INT_FIELD(nMotionNodes); WRITE_INT_FIELD(nInitPlans); /* Don't serialize policy */ WRITE_UINT64_FIELD(query_mem); }
static void _outPartitionRule(StringInfo str, PartitionRule *node) { WRITE_NODE_TYPE("PARTITIONRULE"); WRITE_OID_FIELD(parruleid); WRITE_OID_FIELD(paroid); WRITE_OID_FIELD(parchildrelid); WRITE_OID_FIELD(parparentoid); WRITE_BOOL_FIELD(parisdefault); WRITE_STRING_FIELD(parname); WRITE_NODE_FIELD(parrangestart); WRITE_BOOL_FIELD(parrangestartincl); WRITE_NODE_FIELD(parrangeend); WRITE_BOOL_FIELD(parrangeendincl); WRITE_NODE_FIELD(parrangeevery); WRITE_NODE_FIELD(parlistvalues); WRITE_BINARY_FIELD(parruleord, sizeof(int2)); WRITE_NODE_FIELD(parreloptions); WRITE_OID_FIELD(partemplatespaceId); WRITE_NODE_FIELD(children); }
static void outLogicalIndexInfo(StringInfo str, LogicalIndexInfo *node) { WRITE_OID_FIELD(logicalIndexOid); WRITE_INT_FIELD(nColumns); WRITE_INT_ARRAY(indexKeys, nColumns, AttrNumber); WRITE_NODE_FIELD(indPred); WRITE_NODE_FIELD(indExprs); WRITE_BOOL_FIELD(indIsUnique); WRITE_ENUM_FIELD(indType, LogicalIndexType); WRITE_NODE_FIELD(partCons); WRITE_NODE_FIELD(defaultLevels); }
static void _outPlannedStmt(StringInfo str, PlannedStmt *node) { WRITE_NODE_TYPE("PLANNEDSTMT"); WRITE_ENUM_FIELD(commandType, CmdType); WRITE_ENUM_FIELD(planGen, PlanGenerator); WRITE_BOOL_FIELD(canSetTag); WRITE_BOOL_FIELD(transientPlan); WRITE_NODE_FIELD(planTree); WRITE_NODE_FIELD(rtable); WRITE_NODE_FIELD(resultRelations); WRITE_NODE_FIELD(utilityStmt); WRITE_NODE_FIELD(intoClause); WRITE_NODE_FIELD(subplans); WRITE_NODE_FIELD(rewindPlanIDs); WRITE_NODE_FIELD(returningLists); WRITE_NODE_FIELD(result_partitions); WRITE_NODE_FIELD(result_aosegnos); WRITE_NODE_FIELD(queryPartOids); WRITE_NODE_FIELD(queryPartsMetadata); WRITE_NODE_FIELD(numSelectorsPerScanId); WRITE_NODE_FIELD(rowMarks); WRITE_NODE_FIELD(relationOids); WRITE_NODE_FIELD(invalItems); WRITE_INT_FIELD(nCrossLevelParams); WRITE_INT_FIELD(nMotionNodes); WRITE_INT_FIELD(nInitPlans); /* Don't serialize policy */ WRITE_NODE_FIELD(sliceTable); WRITE_UINT64_FIELD(query_mem); WRITE_NODE_FIELD(transientTypeRecords); }
static void _outPartition(StringInfo str, Partition *node) { WRITE_NODE_TYPE("PARTITION"); WRITE_OID_FIELD(partid); WRITE_OID_FIELD(parrelid); WRITE_CHAR_FIELD(parkind); WRITE_INT_FIELD(parlevel); WRITE_BOOL_FIELD(paristemplate); WRITE_BINARY_FIELD(parnatts, sizeof(int2)); WRITE_INT_ARRAY(paratts, parnatts, int2); WRITE_OID_ARRAY(parclass, parnatts); }
static void _outJoinExpr(StringInfo str, JoinExpr *node) { WRITE_NODE_TYPE("JOINEXPR"); WRITE_ENUM_FIELD(jointype, JoinType); WRITE_BOOL_FIELD(isNatural); WRITE_NODE_FIELD(larg); WRITE_NODE_FIELD(rarg); WRITE_NODE_FIELD(usingClause); WRITE_NODE_FIELD(quals); WRITE_NODE_FIELD(alias); WRITE_INT_FIELD(rtindex); }
static void set_T_RestrictInfo(DebugGraph *graph, DebugNode *n, PlannerInfo *root, Node *node) { RestrictInfo *actual_node = (RestrictInfo*) node; { const char *aux; aux = getExpr((Node *) actual_node->clause, root->parse->rtable); WRITE_CUSTOM_FIELD("clause", "%s", aux); pfree((void*)aux); aux = getExpr((Node *) actual_node->orclause, root->parse->rtable); WRITE_CUSTOM_FIELD("orclause", "%s", aux); pfree((void*)aux); } WRITE_BOOL_FIELD(is_pushed_down); WRITE_BOOL_FIELD(outerjoin_delayed); WRITE_BOOL_FIELD(can_join); WRITE_BOOL_FIELD(pseudoconstant); WRITE_FLOAT_FIELD(eval_cost.startup, "%lf"); WRITE_FLOAT_FIELD(eval_cost.per_tuple, "%lf"); WRITE_FLOAT_FIELD(norm_selec, "%lf"); WRITE_FLOAT_FIELD(outer_selec, "%lf"); }