aboutsummaryrefslogtreecommitdiffstats
path: root/lib/nt.ml
diff options
context:
space:
mode:
authorEstevan Castilho <tevo@riajuu.net>2026-05-30 02:52:21 +0000
committerEstevan Castilho <tevo@riajuu.net>2026-06-13 00:28:12 +0000
commit52d8859ee6b2176ca13c3ea6c79d1c8b251658d5 (patch)
tree98d741d9695e54cb001af8fbf97f0825855d7a93 /lib/nt.ml
parent57b55b51ee6a1d4678ba37e4631d61a248411ff2 (diff)
downloadSakura-52d8859ee6b2176ca13c3ea6c79d1c8b251658d5.tar.gz
Sakura-52d8859ee6b2176ca13c3ea6c79d1c8b251658d5.zip
`Project` plan node
Diffstat (limited to 'lib/nt.ml')
-rw-r--r--lib/nt.ml7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/nt.ml b/lib/nt.ml
index 3882288..41de1d0 100644
--- a/lib/nt.ml
+++ b/lib/nt.ml
@@ -33,6 +33,7 @@ type plan_node =
concrete join algorithm (e.g. HashJoin, NestedLoop, LeapFrog, &c) *)
| Join of { left : plan_node; right : plan_node; on_attrs : string list }
| Take of { limit : int; source : plan_node }
+ | Project of { source : plan_node; attrs : string list }
module Error = struct
open Condition
@@ -326,6 +327,12 @@ module Make (B : Backend) = struct
(match Nt_ffi.ptr_to_opt raw with
| None -> Error (Error.cursor_error "plan_take failed")
| Some p -> Ok p)
+ | Project { source; attrs } ->
+ Nt_ffi.with_strings_as_char_array attrs (fun attrs ->
+ let* sp = build_plan source in
+ let raw = Nt_ffi.rnt_plan_project (Nt_ffi.nint_to_ptr sp) attrs in
+ Nt_ffi.ptr_to_opt raw
+ |> Option.to_result ~none:(Error.cursor_error "plan_project failed"))
let execute_query (plan : plan_node) ~(rel_name : string) :
(tuple_stream, Condition.t) result =