Skip to content

Commit f04f7de

Browse files
committed
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
1 parent a7f9610 commit f04f7de

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

code/common/merge.q

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ checkenumerabletype:{[tablename;extrapartitiontype]
4040
getextrapartitions:{[tablename;extrapartitiontype]
4141
value each ?[tablename;();1b;extrapartitiontype!extrapartitiontype]
4242
};
43+
/ - functional select equivilent to select distinct [ extrapartitiontype ] from [ tablename ] group exec {first each string x} distinct [ extrapartitiontype ] from [ tablename ]
44+
45+
getfirstcharpartitions:{[tablename;extrapartitiontype] raze each value (?[tablename;();();(distinct;first extrapartitiontype)]) group ?[tablename;();();({first each string x};(distinct;first extrapartitiontype))]};
46+
4347

4448
/-function to return partition directory chunks that will be called in batch by mergebypart function
4549
getpartchunks:{[partdirs;mergelimit]

code/processes/wdb.q

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,7 @@ savetablesbypart:{[dir;pt;forcesave;tablename;writedownmode]
168168
/- check if provided column extrapartitiontype indeed has an enumerable type in table
169169
if[writedownmode~`partbyenum;.merge.checkenumerabletype[tablename;extrapartitiontype]];
170170
/- get list of distinct combinations for partition directories
171-
extrapartitions:.merge.getextrapartitions[tablename;extrapartitiontype];
172-
if[writedownmode~`partbyfirstchar;
173-
extrapartitions:value extrapartitions group .Q.fu[{first each string x}; extrapartitions:raze extrapartitions]];
171+
extrapartitions:$[writedownmode~`partbyfirstchar;.merge.getfirstcharpartitions;.merge.getextrapartitions][tablename;extrapartitiontype];
174172
/- enumerate data to be upserted
175173
enumdata:.Q.en[hdbsettings[`hdbdir];0!.save.manipulate[tablename;`. tablename]];
176174
.lg.o[`save;"enumerated ",(string tablename)," table"];

0 commit comments

Comments
 (0)