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 _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); }
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 _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 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 _outConst(StringInfo str, Const *node) { WRITE_NODE_TYPE("CONST"); WRITE_OID_FIELD(consttype); WRITE_INT_FIELD(consttypmod); WRITE_INT_FIELD(constlen); WRITE_BOOL_FIELD(constbyval); WRITE_BOOL_FIELD(constisnull); if (!node->constisnull) _outDatum(str, node->constvalue, node->constlen, node->constbyval); }
void OutDeferredErrorMessage(OUTFUNC_ARGS) { WRITE_LOCALS(DeferredErrorMessage); WRITE_NODE_TYPE("DEFERREDERRORMESSAGE"); WRITE_INT_FIELD(code); WRITE_STRING_FIELD(message); WRITE_STRING_FIELD(detail); WRITE_STRING_FIELD(hint); WRITE_STRING_FIELD(filename); WRITE_INT_FIELD(linenumber); WRITE_STRING_FIELD(functionname); }
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 _outSetOp(StringInfo str, SetOp *node) { WRITE_NODE_TYPE("SETOP"); _outPlanInfo(str, (Plan *) node); WRITE_ENUM_FIELD(cmd, SetOpCmd); WRITE_INT_FIELD(numCols); WRITE_INT_ARRAY(dupColIdx, numCols, AttrNumber); WRITE_INT_FIELD(flagColIdx); }
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 _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); }
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); }
static void _outList(StringInfo str, List *node) { ListCell *lc; if (node == NULL) { int16 tg = 0; appendBinaryStringInfo(str, (const char *)&tg, sizeof(int16)); return; } WRITE_NODE_TYPE(""); WRITE_INT_FIELD(length); foreach(lc, node) { if (IsA(node, List)) { _outNode(str, lfirst(lc)); } else if (IsA(node, IntList)) { int n = lfirst_int(lc); appendBinaryStringInfo(str, (const char *)&n, sizeof(int)); } else if (IsA(node, OidList)) { Oid n = lfirst_oid(lc); appendBinaryStringInfo(str, (const char *)&n, sizeof(Oid)); } } }
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); }
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 _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 _outPartitionBoundSpec(StringInfo str, PartitionBoundSpec *node) { WRITE_NODE_TYPE("PARTITIONBOUNDSPEC"); WRITE_NODE_FIELD(partStart); WRITE_NODE_FIELD(partEnd); WRITE_NODE_FIELD(partEvery); WRITE_INT_FIELD(location); }
static void _outAExpr(StringInfo str, A_Expr *node) { WRITE_NODE_TYPE("AEXPR"); WRITE_ENUM_FIELD(kind, A_Expr_Kind); switch (node->kind) { case AEXPR_OP: WRITE_NODE_FIELD(name); break; case AEXPR_AND: break; case AEXPR_OR: break; case AEXPR_NOT: break; case AEXPR_OP_ANY: WRITE_NODE_FIELD(name); break; case AEXPR_OP_ALL: WRITE_NODE_FIELD(name); break; case AEXPR_DISTINCT: WRITE_NODE_FIELD(name); break; case AEXPR_NULLIF: WRITE_NODE_FIELD(name); break; case AEXPR_OF: WRITE_NODE_FIELD(name); break; case AEXPR_IN: WRITE_NODE_FIELD(name); break; default: break; } WRITE_NODE_FIELD(lexpr); WRITE_NODE_FIELD(rexpr); WRITE_INT_FIELD(location); }
static void _outAConst(StringInfo str, A_Const *node) { WRITE_NODE_TYPE("A_CONST"); _outValue(str, &(node->val)); WRITE_NODE_FIELD(typname); WRITE_INT_FIELD(location); /*CDB*/ }
static void set_T_HashPath(DebugGraph *graph, DebugNode *n, PlannerInfo *root, Node *node) { HashPath *actual_node = (HashPath*) node; set_T_JoinPath(graph, n, root, node); /* inheritance */ WRITE_NODE_FIELD(path_hashclauses); WRITE_INT_FIELD(num_batches); }
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 _outWindowKey(StringInfo str, WindowKey *node) { WRITE_NODE_TYPE("WINDOWKEY"); WRITE_INT_FIELD(numSortCols); WRITE_INT_ARRAY(sortColIdx, numSortCols, AttrNumber); WRITE_OID_ARRAY(sortOperators, numSortCols); WRITE_NODE_FIELD(frame); }
void OutMultiTable(OUTFUNC_ARGS) { WRITE_LOCALS(MultiTable); WRITE_NODE_TYPE("MULTITABLE"); WRITE_OID_FIELD(relationId); WRITE_INT_FIELD(rangeTableId); OutMultiUnaryNodeFields(str, (const MultiUnaryNode *) node); }
static void _outSubLink(StringInfo str, SubLink *node) { WRITE_NODE_TYPE("SUBLINK"); WRITE_ENUM_FIELD(subLinkType, SubLinkType); WRITE_NODE_FIELD(testexpr); WRITE_NODE_FIELD(operName); WRITE_INT_FIELD(location); /*CDB*/ WRITE_NODE_FIELD(subselect); }
static void _outCurrentOfExpr(StringInfo str, CurrentOfExpr *node) { WRITE_NODE_TYPE("CURRENTOFEXPR"); WRITE_STRING_FIELD(cursor_name); WRITE_UINT_FIELD(cvarno); WRITE_OID_FIELD(target_relid); WRITE_INT_FIELD(gp_segment_id); WRITE_BINARY_FIELD(ctid, sizeof(ItemPointerData)); WRITE_OID_FIELD(tableoid); }
static void _outUnique(StringInfo str, Unique *node) { WRITE_NODE_TYPE("UNIQUE"); _outPlanInfo(str, (Plan *) node); WRITE_INT_FIELD(numCols); WRITE_INT_ARRAY(uniqColIdx, node->numCols, AttrNumber); WRITE_OID_ARRAY(uniqOperators, node->numCols); }
/* * 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 _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 _outFlow(StringInfo str, Flow *node) { WRITE_NODE_TYPE("FLOW"); WRITE_ENUM_FIELD(flotype, FlowType); WRITE_ENUM_FIELD(req_move, Movement); WRITE_ENUM_FIELD(locustype, CdbLocusType); WRITE_INT_FIELD(segindex); /* This array format as in Group and Sort nodes. */ WRITE_INT_FIELD(numSortCols); WRITE_INT_ARRAY(sortColIdx, numSortCols, AttrNumber); WRITE_OID_ARRAY(sortOperators, numSortCols); WRITE_NODE_FIELD(hashExpr); WRITE_NODE_FIELD(flow_before_req_move); }
static void _outWindow(StringInfo str, Window *node) { WRITE_NODE_TYPE("WINDOW"); _outPlanInfo(str, (Plan *) node); WRITE_INT_FIELD(numPartCols); WRITE_INT_ARRAY(partColIdx, numPartCols, AttrNumber); WRITE_NODE_FIELD(windowKeys); }