* Executes a local insert plan for a sharded table using the provided PlannedStmt. * Returns the number of rows processed. */
| 1674 | * Returns the number of rows processed. |
| 1675 | */ |
| 1676 | static uint64_t |
| 1677 | ExecuteLocalShardInsertPlan(PlannedStmt *queryPlan, ParamListInfo paramListInfo) |
| 1678 | { |
| 1679 | ScanDirection scanDirection = ForwardScanDirection; |
| 1680 | QueryEnvironment *queryEnv = create_queryEnv(); |
| 1681 | int eflags = 0; |
| 1682 | |
| 1683 | MemoryContext localContext = AllocSetContextCreate(CurrentMemoryContext, |
| 1684 | "DocumentDBExecutePlan", |
| 1685 | ALLOCSET_DEFAULT_SIZES); |
| 1686 | MemoryContext oldContext = MemoryContextSwitchTo(localContext); |
| 1687 | DestReceiver *receiver = CreateDestReceiver(DestNone); |
| 1688 | |
| 1689 | /* Create a QueryDesc for the query */ |
| 1690 | QueryDesc *queryDesc = CreateQueryDesc(queryPlan, "", |
| 1691 | GetActiveSnapshot(), InvalidSnapshot, |
| 1692 | receiver, paramListInfo, |
| 1693 | queryEnv, 0); |
| 1694 | |
| 1695 | ExecutorStart(queryDesc, eflags); |
| 1696 | |
| 1697 | ExecutorRun_Compat(queryDesc, scanDirection, 0L, true); |
| 1698 | |
| 1699 | uint64_t numRowsProcessed = queryDesc->estate->es_processed; |
| 1700 | |
| 1701 | ExecutorFinish(queryDesc); |
| 1702 | ExecutorEnd(queryDesc); |
| 1703 | |
| 1704 | FreeQueryDesc(queryDesc); |
| 1705 | MemoryContextSwitchTo(oldContext); |
| 1706 | MemoryContextDelete(localContext); |
| 1707 | |
| 1708 | return numRowsProcessed; |
| 1709 | } |
| 1710 | |
| 1711 | |
| 1712 | /* indicates the presence of a creation_time column in the table, either at attribute number 4 or 5 */ |
no outgoing calls
no test coverage detected