149 scanstate->repeatable =
157 scanstate->seed =
random();
163 scanstate->tsmroutine = tsm;
164 scanstate->tsm_state = NULL;
170 scanstate->begun =
false;
249 foreach(arg, scanstate->
args)
258 (
errcode(ERRCODE_INVALID_TABLESAMPLE_ARGUMENT),
259 errmsg(
"TABLESAMPLE parameter cannot be null")));
270 (
errcode(ERRCODE_INVALID_TABLESAMPLE_REPEAT),
271 errmsg(
"TABLESAMPLE REPEATABLE parameter cannot be null")));
290 seed = scanstate->
seed;
328 scanstate->
begun =
true;
352 scanstate->
done =
true;
InitSampleScan_function InitSampleScan
#define DatumGetUInt32(X)
static Datum ExecEvalExprSwitchContext(ExprState *state, ExprContext *econtext, bool *isNull)
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
#define RelationGetDescr(relation)
#define castNode(_type_, nodeptr)
TupleTableSlot * ExecScan(ScanState *node, ExecScanAccessMtd accessMtd, ExecScanRecheckMtd recheckMtd)
ExprContext * ps_ExprContext
const TupleTableSlotOps * table_slot_callbacks(Relation relation)
struct TableSampleClause * tablesample
struct TableScanDescData * ss_currentScanDesc
int errcode(int sqlerrcode)
static TupleTableSlot * SampleNext(SampleScanState *node)
TupleTableSlot * ss_ScanTupleSlot
static bool table_scan_sample_next_block(TableScanDesc scan, struct SampleScanState *scanstate)
static TableScanDesc table_beginscan_sampling(Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key, bool allow_strat, bool allow_sync, bool allow_pagemode)
#define DirectFunctionCall1(func, arg1)
Relation ss_currentRelation
void ExecFreeExprContext(PlanState *planstate)
ExprState * ExecInitQual(List *qual, PlanState *parent)
static bool table_scan_sample_next_tuple(TableScanDesc scan, struct SampleScanState *scanstate, TupleTableSlot *slot)
TupleTableSlot * ps_ResultTupleSlot
void pfree(void *pointer)
void ExecAssignScanProjectionInfo(ScanState *node)
Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)
SampleScanState * ExecInitSampleScan(SampleScan *node, EState *estate, int eflags)
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
void ExecInitResultTypeTL(PlanState *planstate)
List * ExecInitExprList(List *nodes, PlanState *parent)
static TupleTableSlot * tablesample_getnext(SampleScanState *scanstate)
NextSampleBlock_function NextSampleBlock
Datum hashfloat8(PG_FUNCTION_ARGS)
bool(* ExecScanRecheckMtd)(ScanState *node, TupleTableSlot *slot)
static void tablesample_init(SampleScanState *scanstate)
ExecProcNodeMtd ExecProcNode
static bool SampleRecheck(SampleScanState *node, TupleTableSlot *slot)
static void table_rescan_set_params(TableScanDesc scan, struct ScanKeyData *key, bool allow_strat, bool allow_sync, bool allow_pagemode)
void ExecEndSampleScan(SampleScanState *node)
#define ereport(elevel,...)
TsmRoutine * GetTsmRoutine(Oid tsmhandler)
#define Assert(condition)
void ExecAssignExprContext(EState *estate, PlanState *planstate)
static int list_length(const List *l)
struct TsmRoutine * tsmroutine
BeginSampleScan_function BeginSampleScan
static void table_endscan(TableScanDesc scan)
int errmsg(const char *fmt,...)
void ExecReScanSampleScan(SampleScanState *node)
void ExecScanReScan(ScanState *node)
ExprState * ExecInitExpr(Expr *node, PlanState *parent)
TupleTableSlot *(* ExecScanAccessMtd)(ScanState *node)
EndSampleScan_function EndSampleScan
static TupleTableSlot * ExecSampleScan(PlanState *pstate)