From 737b4c19d14a12e05ec862d23f8f29ff790a73c2 Mon Sep 17 00:00:00 2001 From: Marcos Magueta Date: Thu, 27 Feb 2025 23:20:45 -0300 Subject: add partition and debugger --- lib/planner.ml | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) (limited to 'lib/planner.ml') diff --git a/lib/planner.ml b/lib/planner.ml index 1d4d830..0d333f1 100644 --- a/lib/planner.ml +++ b/lib/planner.ml @@ -1,17 +1,28 @@ +module type Action = sig + (* Names of the attributes & The tuples *) + type tuples = string list * bytes list list + val execute: tuples -> int +end + module Scan = struct - (* open Disk - let execute commit locations (entity: string) = - let binary = Executor.read commit locations ~filename:("schema~" ^ entity) in - let relation = - Result.map_error (fun _ -> "Failed to deserialize relation from binary format.") - @@ Data_encoding.Binary.of_bytes Schema.Protocol.relation_encoding (Bytes.concat Bytes.empty binary) in - match relation with - | Ok relation -> - begin - let attrs = List.map (fun (a: Schema.Protocol.attribute) -> relation.name ^ "/" ^ a.name) relation.attributes in - Executor.read commit locations ~filename:("schema~" ^ entity) - end - | Error err -> failwith err *) + open Disk + let execute commit locations (entity: string) = + Executor.read commit locations ~filename:("schema~" ^ entity) + |> function + | Some binary -> + begin + let relation = + Result.map_error (fun _ -> "Failed to deserialize relation from binary format.") + @@ Data_encoding.Binary.of_bytes Schema.Protocol.relation_encoding (Bytes.concat Bytes.empty binary) in + match relation with + | Ok relation -> + begin + let _attrs = List.map (fun (a: Schema.Protocol.attribute) -> relation.name ^ "/" ^ a.name) relation.attributes in + Executor.read commit locations ~filename:("schema~" ^ entity) + end + | Error err -> failwith err + end + | None -> failwith "" end module Join = struct -- cgit v1.2.3