cancel
Showing results for 
Search instead for 
Did you mean: 

Splayed table lost attribute after upsert

Swee_Heng
New Contributor


Hi all, I have a splayed table with the `s attribute set in one
column. After an upsert, the attribute disappeared. This did not
happen if I save it as a "flat" table instead. Sample code below. Is
this an expected behavior? How can I preserve attributes in splayed
tables?

q)d:{-1 "=== ",y," ==="; show x; show meta x} / display function
q)t:([]`s#x:1 2;y:1.1 1.2); d[t;"t"] / table with `s attribute in x-
column
=== t ===
x y
-----
1 1.1
2 1.2
c| t f a
-| -----
x| i s
y| f
q)FT:`:test/ft set t / flat table
q)ST:`:test/st/ set t / splayed table
q)d[get FT;"flat t"]
=== flat t ===
x y
-----
1 1.1
2 1.2
c| t f a
-| -----
x| i s
y| f
q)d[get ST;"splayed t"]
=== splayed t ===
x y
-----
1 1.1
2 1.2
c| t f a
-| -----
x| i s
y| f
q)FT upsert 1+last t
`:test/ft
q)ST upsert 1+last t
`:test/st/
q)d[get FT;"flat t (after upsert)"] / s attribute preserved
=== flat t (after upsert) ===
x y
-----
1 1.1
2 1.2
3 2.2
c| t f a
-| -----
x| i s
y| f
q)d[get ST;"splayed t (after upsert)"] / s attribute lost
=== splayed t (after upsert) ===
x y
-----
1 1.1
2 1.2
3 2.2
c| t f a
-| -----
x| i
y| f


Swee Heng

1 REPLY 1

felix1
New Contributor

X-Mailer: Apple Mail (2.929.2)

yes, it is the right behavior. the upsert doen't check the order on
large mapped file.
to keep it materialize first and then resave it.

felix