diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2025-03-22 14:00:01 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2025-03-22 14:00:01 -0300 |
| commit | fb0ade9daf1e9d1cd0a29dd1abe87468ab03a174 (patch) | |
| tree | 255b7a8bece7e791ebf8ba8ad6d424f744b33030 /lib/planner.ml | |
| parent | d533b170f6b614000a84f8b3a6174f6fc539eb90 (diff) | |
| download | Sakura-fb0ade9daf1e9d1cd0a29dd1abe87468ab03a174.tar.gz Sakura-fb0ade9daf1e9d1cd0a29dd1abe87468ab03a174.zip | |
add relation type and format
Diffstat (limited to 'lib/planner.ml')
| -rw-r--r-- | lib/planner.ml | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/lib/planner.ml b/lib/planner.ml index 0d333f1..0470092 100644 --- a/lib/planner.ml +++ b/lib/planner.ml @@ -1,28 +1,33 @@ module type Action = sig (* Names of the attributes & The tuples *) type tuples = string list * bytes list list - val execute: tuples -> int + + val execute : tuples -> int end module Scan = struct 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 "" + + let execute commit locations (entity : string) = + Executor.read commit locations ~filename:("schema~" ^ entity) |> function + | Some binary -> ( + 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 -> + let _attrs = + List.map + (fun (a : Schema.Protocol.attribute) -> + relation.name ^ "/" ^ a.name) + relation.attributes + in + Executor.read commit locations ~filename:("schema~" ^ entity) + | Error err -> failwith err) + | None -> failwith "" end module Join = struct |
