PostgreSQL Source Code: src/backend/executor/nodeSort.c Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

17

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

51{

57

59

60

61

62

64 "entering routine");

65

69

70

71

72

73

74

76 {

81

83 "sorting subplan");

84

85

86

87

88

90

91

92

93

95 "calling tuplesort_begin");

96

99

104

107 plannode->sortOperators[0],

108 plannode->collations[0],

109 plannode->nullsFirst[0],

111 NULL,

112 tuplesortopts);

113 else

116 plannode->sortColIdx,

117 plannode->sortOperators,

118 plannode->collations,

119 plannode->nullsFirst,

121 NULL,

122 tuplesortopts);

126

127

128

129

130

132 {

133 for (;;)

134 {

136

138 break;

143 }

144 }

145 else

146 {

147 for (;;)

148 {

150

152 break;

154 }

155 }

156

157

158

159

161

162

163

164

166

167

168

169

174 {

176

178 Assert(ParallelWorkerNumber <= node->shared_info->num_workers);

181 }

182 SO1_printf("ExecSort: %s\n", "sorting done");

183 }

184

186 "retrieving tuple from tuplesort");

187

189

190

191

192

193

194

195

196

198 {

204 }

205 else

208 false, slot, NULL);

209

210 return slot;

211}

212

213

214

215

216

217

218

219

222{

225

227 "initializing sort node");

228

229

230

231

236

237

238

239

240

241

245

246 sortstate->bounded = false;

249

250

251

252

253

254

255

256

257

258

259

260

261

262

264

266

267

268

269

271

272

273

274

275

278

280

281

282

283

284

285 if (outerTupDesc->natts == 1)

287 else

289

291 "sort node initialized");

292

293 return sortstate;

294}

295

296

297

298

299

300void

302{

304 "shutting down sort node");

305

306

307

308

312

313

314

315

317

319 "sort node shutdown");

320}

321

322

323

324

325

326

327

328void

330{

331

332

333

335 return;

336

338}

339

340

341

342

343

344

345

346void

348{

349

350

351

353 return;

354

355

356

357

359}

360

361void

363{

365

366

367

368

369

370

372 return;

373

374

376

377

378

379

380

381

382

383

384 if (outerPlan->chgParam != NULL ||

388 {

392

393

394

395

396

399 }

400 else

402}

403

404

405

406

407

408

409

410

411

412

413

414

415void

417{

419

420

422 return;

423

428}

429

430

431

432

433

434

435

436void

438{

440

441

443 return;

444

448

453}

454

455

456

457

458

459

460

461void

463{

467}

468

469

470

471

472

473

474

475void

477{

480

482 return;

483

489}

void ExecReScan(PlanState *node)

void ExecEndNode(PlanState *node)

PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)

const TupleTableSlotOps TTSOpsVirtual

TupleTableSlot * ExecStoreVirtualTuple(TupleTableSlot *slot)

void ExecInitResultTupleSlotTL(PlanState *planstate, const TupleTableSlotOps *tts_ops)

const TupleTableSlotOps TTSOpsMinimalTuple

TupleDesc ExecGetResultType(PlanState *planstate)

void ExecCreateScanSlotFromOuterPlan(EState *estate, ScanState *scanstate, const TupleTableSlotOps *tts_ops)

#define outerPlanState(node)

#define EXEC_FLAG_BACKWARD

static TupleTableSlot * ExecProcNode(PlanState *node)

Assert(PointerIsAligned(start, uint64))

#define IsParallelWorker()

if(TABLE==NULL||TABLE_index==NULL)

#define CHECK_FOR_INTERRUPTS()

SortState * ExecInitSort(Sort *node, EState *estate, int eflags)

void ExecSortMarkPos(SortState *node)

static TupleTableSlot * ExecSort(PlanState *pstate)

void ExecSortInitializeWorker(SortState *node, ParallelWorkerContext *pwcxt)

void ExecReScanSort(SortState *node)

void ExecSortRestrPos(SortState *node)

void ExecSortEstimate(SortState *node, ParallelContext *pcxt)

void ExecSortInitializeDSM(SortState *node, ParallelContext *pcxt)

void ExecSortRetrieveInstrumentation(SortState *node)

void ExecEndSort(SortState *node)

#define castNode(_type_, nodeptr)

#define ScanDirectionIsForward(direction)

void * shm_toc_allocate(shm_toc *toc, Size nbytes)

void shm_toc_insert(shm_toc *toc, uint64 key, void *address)

void * shm_toc_lookup(shm_toc *toc, uint64 key, bool noError)

#define shm_toc_estimate_chunk(e, sz)

#define shm_toc_estimate_keys(e, cnt)

Size add_size(Size s1, Size s2)

Size mul_size(Size s1, Size s2)

ScanDirection es_direction

shm_toc_estimator estimator

Instrumentation * instrument

TupleTableSlot * ps_ResultTupleSlot

ProjectionInfo * ps_ProjInfo

ExecProcNodeMtd ExecProcNode

SharedSortInfo * shared_info

static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)

void tuplesort_rescan(Tuplesortstate *state)

void tuplesort_performsort(Tuplesortstate *state)

void tuplesort_get_stats(Tuplesortstate *state, TuplesortInstrumentation *stats)

void tuplesort_end(Tuplesortstate *state)

void tuplesort_markpos(Tuplesortstate *state)

void tuplesort_restorepos(Tuplesortstate *state)

void tuplesort_set_bound(Tuplesortstate *state, int64 bound)

#define TUPLESORT_RANDOMACCESS

#define TUPLESORT_ALLOWBOUNDED

struct TuplesortInstrumentation TuplesortInstrumentation

void tuplesort_putdatum(Tuplesortstate *state, Datum val, bool isNull)

void tuplesort_puttupleslot(Tuplesortstate *state, TupleTableSlot *slot)

Tuplesortstate * tuplesort_begin_heap(TupleDesc tupDesc, int nkeys, AttrNumber *attNums, Oid *sortOperators, Oid *sortCollations, bool *nullsFirstFlags, int workMem, SortCoordinate coordinate, int sortopt)

bool tuplesort_gettupleslot(Tuplesortstate *state, bool forward, bool copy, TupleTableSlot *slot, Datum *abbrev)

Tuplesortstate * tuplesort_begin_datum(Oid datumType, Oid sortOperator, Oid sortCollation, bool nullsFirstFlag, int workMem, SortCoordinate coordinate, int sortopt)

bool tuplesort_getdatum(Tuplesortstate *state, bool forward, bool copy, Datum *val, bool *isNull, Datum *abbrev)

static void slot_getsomeattrs(TupleTableSlot *slot, int attnum)

static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)