aboutsummaryrefslogtreecommitdiffstats
path: root/include/RNT_C_API.h
diff options
context:
space:
mode:
authorEstevan Castilho <tevo@riajuu.net>2026-06-22 23:07:12 +0000
committerGitHub <noreply@github.com>2026-06-22 20:07:12 -0300
commit9f0e1c642680c69e10eb1760be07984f9ecc6d39 (patch)
tree7846831cdab248b8c27706e3ab67296c7100786c /include/RNT_C_API.h
parenta4f6637601548a7158869ad155f29db50b151823 (diff)
downloadRNT-9f0e1c642680c69e10eb1760be07984f9ecc6d39.tar.gz
RNT-9f0e1c642680c69e10eb1760be07984f9ecc6d39.zip
Fix joins, rename, union
Co-authored-by: Marcos Magueta <maguetamarcos@gmail.com>
Diffstat (limited to '')
-rw-r--r--include/RNT_C_API.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/RNT_C_API.h b/include/RNT_C_API.h
index 1a59785..19f6165 100644
--- a/include/RNT_C_API.h
+++ b/include/RNT_C_API.h
@@ -397,6 +397,7 @@ typedef struct {
typedef struct {
rnt_plan_t left;
rnt_plan_t right;
+ const char** attrs;
} PlanArgsJoin;
/**
@@ -422,6 +423,38 @@ typedef struct {
} PlanArgsProject;
/**
+ * MATERIALIZE context: caches @p source on its first scan, then replays the
+ * cache on later scans without touching @p source again.
+ *
+ * Put this on the inner side of a JOIN so the inner relation is read once
+ * instead of once per outer tuple. Only safe when @p source does not depend on
+ * the outer tuple (no Var SCAN leaves bound by the JOIN), since the cache is
+ * reused as-is for every outer tuple. Takes ownership of @p source; on failure
+ * @p source is freed.
+ */
+typedef struct {
+ rnt_plan_t source;
+} PlanArgsMaterialize;
+
+/**
+ * RENAME context: returns @p source, with the keys of @p pairs the values of it.
+ *
+ * @p pairs is a NULL-terminated array of pairs containing the original attribute
+ * name together with it's new name.
+ */
+
+typedef struct {
+ rnt_plan_t source;
+ const char** pairs;
+} PlanArgsRename;
+
+/** UNION context. */
+
+typedef struct {
+ rnt_plan_t *sources;
+} PlanArgsUnion;
+
+/**
* A single plan-construction request. @p operation selects which context member
* is read; the others are ignored. The members are laid out side by side rather
* than overlapped in a union so the struct maps cleanly onto OCaml ctypes, which
@@ -433,6 +466,9 @@ typedef struct {
PlanArgsJoin join;
PlanArgsTake take;
PlanArgsProject project;
+ PlanArgsMaterialize materialize;
+ PlanArgsRename rename;
+ PlanArgsUnion union_;
} PlanAction;
/**