![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
SQL function provsql.rv_sample(token, n, prov). More...
#include "postgres.h"#include "fmgr.h"#include "funcapi.h"#include "miscadmin.h"#include "utils/builtins.h"#include "utils/uuid.h"#include "provsql_utils.h"#include "provsql_error.h"#include "CircuitFromMMap.h"#include "GenericCircuit.h"#include "MonteCarloSampler.h"#include "provsql_utils_cpp.h"#include <algorithm>#include <vector>
Go to the source code of this file.
Functions | |
| Datum | rv_sample (PG_FUNCTION_ARGS) |
SQL function provsql.rv_sample(token, n, prov).
Returns up to n samples from the (possibly conditional) scalar distribution rooted at token. When prov resolves to gate_one the samples come from the unconditional distribution (one draw per call to monteCarloScalarSamples); when prov is a non-trivial gate the path switches to MC rejection via monteCarloConditionalScalarSamples, with a budget large enough to deliver n accepted draws under the acceptance_floor heuristic.
Result: SETOF float8 emitted through the Materialize SRF pattern (same shape as shapley_all_vars). The unconditional path always returns exactly n rows; the conditional path may return fewer, in which case a NOTICE is emitted so the caller can choose to widen the budget by raising provsql.rv_mc_samples.
Definition in file RvSample.cpp.
| Datum rv_sample | ( | PG_FUNCTION_ARGS | ) |