I am having problems when I want to add column symbol or string to a splay table. I encounter a type error when trying to add data to the splay. Below is an example of the errors I am having.
For instance if I make a splay table as follows and upsert a small table into the splay it works
db_big: ( id:
aa
bb; ti:1 2 ; p:1.1 1.2; str:(“a&a”;“b&b”))db_big: .Q.en[`:c:/q/splay/] db_big
`:c:/q/splay/db_big/ set db_big
db_small: ( id:
symbol$(); ti:
int$() ; p:`float$(); str:())
db_small insert (
ff;6;1.6;“”)db_small: .Q.en[`:c:/q/splay/] db_small
`:c:/q/splay/db_big/ upsert db_small;
Adding new float column “p1” which is not a symbol works fine when upserting to splay
db_small: ( id:
symbol$(); ti:
int$() ; p:`float$(); str:())
db_small insert (
ff;6;1.6;“”)db_small: .Q.en[`:c:/q/splay/] db_small
`:c:/q/splay/db_big/ upsert db_small;
@[
:c:/q/splay/db_big;
p1; : ; (count db_big)#0n].[
:c:/q/splay/db_big/.d;(); , ;
p1]db_small: ( id:
symbol$(); ti:
int$() ; p:float$();str:();p1:
float$())
db_small insert (
ff;6;1.6;“”;1.7)db_small: .Q.en[`:c:/q/splay/] db_small
`:c:/q/splay/db_big/ upsert db_small;
However if I try to add a new columns id1:symbol and str1:string to the splay table the upsert fails (type error). Same error occurs if I only add one column (either symbol or string)
@[`:c:/q/splay/db_big; `id1; : ; (count db_big)#`]
.[
:c:/q/splay/db_big/.d;(); , ;
id1]@[
:c:/q/splay/db_big;
str1; : ; (count db_big)#()].[
:c:/q/splay/db_big/.d;(); , ;
str1]db_small: ( id:
symbol$(); ti:
int$() ; p:float$();str:();p1:
float$();id1:`symbol$();str1:())
db_small insert (
ff;6;1.6;“”;1.7;`gg;“”)db_small: .Q.en[`:c:/q/splay/] db_small
`:c:/q/splay/db_big/ upsert db_small;
I can see that I should in some way use .Q.en when adding a symbol or string column but I haven’t found anything in the docs.
meta db_small
ctfa
0ids
1tii
2pf
3strC
4p1f
5id1s
6str1C
meta db_big
ctfa
0ids
1tii
2pf
3strC
4p1f
5id1s
6str1
Can anyone help?
Many thanks
David