Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
tsmapi.h83 linesDownload Raw Back to access
1/*-------------------------------------------------------------------------2 *3 * tsmapi.h4 *	  API for tablesample methods5 *6 * Copyright (c) 2015-2023, PostgreSQL Global Development Group7 *8 * src/include/access/tsmapi.h9 *10 *-------------------------------------------------------------------------11 */12#ifndef TSMAPI_H13#define TSMAPI_H14 15#include "nodes/execnodes.h"16#include "nodes/pathnodes.h"17 18 19/*20 * Callback function signatures --- see tablesample-method.sgml for more info.21 */22 23typedef void (*SampleScanGetSampleSize_function) (PlannerInfo *root,24												  RelOptInfo *baserel,25												  List *paramexprs,26												  BlockNumber *pages,27												  double *tuples);28 29typedef void (*InitSampleScan_function) (SampleScanState *node,30										 int eflags);31 32typedef void (*BeginSampleScan_function) (SampleScanState *node,33										  Datum *params,34										  int nparams,35										  uint32 seed);36 37typedef BlockNumber (*NextSampleBlock_function) (SampleScanState *node,38												 BlockNumber nblocks);39 40typedef OffsetNumber (*NextSampleTuple_function) (SampleScanState *node,41												  BlockNumber blockno,42												  OffsetNumber maxoffset);43 44typedef void (*EndSampleScan_function) (SampleScanState *node);45 46/*47 * TsmRoutine is the struct returned by a tablesample method's handler48 * function.  It provides pointers to the callback functions needed by the49 * planner and executor, as well as additional information about the method.50 *51 * More function pointers are likely to be added in the future.52 * Therefore it's recommended that the handler initialize the struct with53 * makeNode(TsmRoutine) so that all fields are set to NULL.  This will54 * ensure that no fields are accidentally left undefined.55 */56typedef struct TsmRoutine57{58	NodeTag		type;59 60	/* List of datatype OIDs for the arguments of the TABLESAMPLE clause */61	List	   *parameterTypes;62 63	/* Can method produce repeatable samples across, or even within, queries? */64	bool		repeatable_across_queries;65	bool		repeatable_across_scans;66 67	/* Functions for planning a SampleScan on a physical table */68	SampleScanGetSampleSize_function SampleScanGetSampleSize;69 70	/* Functions for executing a SampleScan on a physical table */71	InitSampleScan_function InitSampleScan; /* can be NULL */72	BeginSampleScan_function BeginSampleScan;73	NextSampleBlock_function NextSampleBlock;	/* can be NULL */74	NextSampleTuple_function NextSampleTuple;75	EndSampleScan_function EndSampleScan;	/* can be NULL */76} TsmRoutine;77 78 79/* Functions in access/tablesample/tablesample.c */80extern TsmRoutine *GetTsmRoutine(Oid tsmhandler);81 82#endif							/* TSMAPI_H */83 
codekingpro/portable-devtools · Team Ai