Joining Enumerated and Symbol Column in kdb+ using Over

Viewed 139

Im looking at two tables, one with an enumerated column the other is not. Im using (,/) to join them together and it doesn't unenumerate the data. (uj/) and last (,\) both do. Does anyone why this might be the case?

KDB+ 4.0 2021.04.26 Copyright (C) 1993-2021 Kx Systems

q)enum:`a`b
q)t1:([]c1:`enum$`a`b)
q)t2:([]c1:`a`b)
q)(,/) (t1;t2)
c1
--------
`enum$`a
`enum$`b
`a
`b
q)(uj/) (t1;t2)
c1
--
a
b
a
b
q)last(,\) (t1;t2)
c1
--
a
b
a
b
q)```
1 Answers

I suspect it's because ,/ (along with raze) is given special treatment by the interpreter while the others aren't.

An actual append-over gives you the result you want:

q)0N!({x,y}/)(t1;t2);
+(,`c1)!,`a`b`a`b

So even though {x,y}/ appears to be the same as ,/, that isn't always the case due to the "special treatment" under the covers

Related