From f04f7de03c47f6b22915c9a92ecab6b37be99ee5 Mon Sep 17 00:00:00 2001 From: ryanCheale Date: Tue, 25 Nov 2025 16:43:10 +0000 Subject: [PATCH] merge.q now generates list of groups of first character syms to group save with in wdb.q, updated wdb.q to handle partition flag partbyfirstchar --- code/common/merge.q | 4 ++++ code/processes/wdb.q | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/code/common/merge.q b/code/common/merge.q index f309d7bc8..657ff4b14 100644 --- a/code/common/merge.q +++ b/code/common/merge.q @@ -40,6 +40,10 @@ checkenumerabletype:{[tablename;extrapartitiontype] getextrapartitions:{[tablename;extrapartitiontype] value each ?[tablename;();1b;extrapartitiontype!extrapartitiontype] }; +/ - functional select equivilent to select distinct [ extrapartitiontype ] from [ tablename ] group exec {first each string x} distinct [ extrapartitiontype ] from [ tablename ] + +getfirstcharpartitions:{[tablename;extrapartitiontype] raze each value (?[tablename;();();(distinct;first extrapartitiontype)]) group ?[tablename;();();({first each string x};(distinct;first extrapartitiontype))]}; + /-function to return partition directory chunks that will be called in batch by mergebypart function getpartchunks:{[partdirs;mergelimit] diff --git a/code/processes/wdb.q b/code/processes/wdb.q index f22b6f238..030fc1f53 100644 --- a/code/processes/wdb.q +++ b/code/processes/wdb.q @@ -168,9 +168,7 @@ savetablesbypart:{[dir;pt;forcesave;tablename;writedownmode] /- check if provided column extrapartitiontype indeed has an enumerable type in table if[writedownmode~`partbyenum;.merge.checkenumerabletype[tablename;extrapartitiontype]]; /- get list of distinct combinations for partition directories - extrapartitions:.merge.getextrapartitions[tablename;extrapartitiontype]; - if[writedownmode~`partbyfirstchar; - extrapartitions:value extrapartitions group .Q.fu[{first each string x}; extrapartitions:raze extrapartitions]]; + extrapartitions:$[writedownmode~`partbyfirstchar;.merge.getfirstcharpartitions;.merge.getextrapartitions][tablename;extrapartitiontype]; /- enumerate data to be upserted enumdata:.Q.en[hdbsettings[`hdbdir];0!.save.manipulate[tablename;`. tablename]]; .lg.o[`save;"enumerated ",(string tablename)," table"];