diff options
Diffstat (limited to 'lib/analysers/chunk.ml')
-rw-r--r-- | lib/analysers/chunk.ml | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/analysers/chunk.ml b/lib/analysers/chunk.ml index 2fa4808..cefa6d8 100644 --- a/lib/analysers/chunk.ml +++ b/lib/analysers/chunk.ml @@ -8,13 +8,13 @@ type t = { b : Buffer.t; - parameters : ImportCSV.DataType.t Queue.t; + parameters : ImportDataTypes.Value.t Queue.t; } let create : unit -> t = fun () -> { b = Buffer.create 16; parameters = Queue.create () } -let create' : Buffer.t -> ImportCSV.DataType.t Queue.t -> t = +let create' : Buffer.t -> ImportDataTypes.Value.t Queue.t -> t = fun b parameters -> { b; parameters } (* Append the element from [tail] at the end of [head] @@ -39,10 +39,9 @@ let copy : t -> t = Buffer.add_buffer b t.b; { b; parameters } -let add_parameters : t -> ImportCSV.DataType.t Seq.t -> unit = +let add_parameters : t -> ImportDataTypes.Value.t Seq.t -> unit = fun t p -> Queue.add_seq t.parameters p -module Syntax = ImportConf.Syntax module Table = ImportDataTypes.Table module Q = ImportExpression.Query open StdLabels @@ -53,7 +52,8 @@ open StdLabels - the join query in order to load the data from the external column - the column corresponding to the key in order to identify the missing links later. *) -let join_external : conf:Syntax.t -> join_buffer:t -> Syntax.Extern.t -> unit = +let join_external : + conf:ImporterSyntax.t -> join_buffer:t -> ImporterSyntax.Extern.t -> unit = fun ~conf ~join_buffer external_ -> let extern_table = Table.name external_.target in @@ -67,8 +67,8 @@ let join_external : conf:Syntax.t -> join_buffer:t -> Syntax.Extern.t -> unit = in add_parameters join_buffer (Queue.to_seq q))) - (Table.print_column external_.Syntax.Extern.target - ("key_" ^ external_.Syntax.Extern.target.name)); + (Table.print_column external_.ImporterSyntax.Extern.target + ("key_" ^ external_.ImporterSyntax.Extern.target.name)); Format.pp_print_flush formatter () @@ -78,7 +78,7 @@ let join_external : conf:Syntax.t -> join_buffer:t -> Syntax.Extern.t -> unit = SQLite is able to optimize the query and do not load the table not used in the select clause. *) let create_from_statement_of_chunck : - ?externals:Syntax.Extern.t list -> Syntax.t -> t -> unit = + ?externals:ImporterSyntax.Extern.t list -> ImporterSyntax.t -> t -> unit = fun ?externals conf c -> let externals = Option.value externals ~default:conf.externals in add_string c "\nFROM '"; @@ -91,7 +91,10 @@ let create_from_statement_of_chunck : List.iter externals ~f:(join_external ~conf ~join_buffer:c) let add_expression : - conf:Syntax.t -> t -> ImportDataTypes.Path.t ImportExpression.T.t -> unit = + conf:ImporterSyntax.t -> + t -> + ImportDataTypes.Path.t ImportExpression.T.t -> + unit = fun ~conf group expression -> let formatter = Format.formatter_of_buffer group.b in let queue = |