0

Trying to combine two result sets I've faced with different behavior when joining two keyed tables:

q)show t:([a:1 1 2]b:011b)
a| b
-| -
1| 0
1| 1
2| 1
q)t,t
a| b
-| -
1| 1
1| 1
2| 1
q)(,/)(t;t)
a| b
-| -
1| 1
2| 1

Why does the accumulator ,/ remove duplicated keys, and why its result differs from a direct table join ,?

egor7
  • 4,678
  • 7
  • 31
  • 55

1 Answers1

2

I suspect that join over (aka ,/ aka raze) has special handling under the covers that isn't exposed to the end user.

The interpreter recognises the ,/ and behaves a certain way depending on the inputs. This likely applies to dictionaries and keyed tables:

q)raze(`a`a`b!1 2 3;`a`b!9 9)
a| 9
b| 9
q)
q)(`a`a`b!1 2 3),`a`b!9 9
a| 9
a| 2
b| 9
q)
q)({x,y}/)(`a`a`b!1 2 3;`a`b!9 9)
a| 9
a| 2
b| 9
terrylynch
  • 11,844
  • 13
  • 21