cancel
Showing results for 
Search instead for 
Did you mean: 

Applying P Attribute to Disk

hoffmanroni
New Contributor III
Hi All,

I have a large table on disk and I'm trying to apply `p# attribute to specific date partitions.  I dont think I can use the 

addattrcol

in dbmaint.q, because the db is still loading and I dont want to appy the attribute to partitions that are still being loaded.

I tried

@[`:db/2014.12.01/tab;`sym;`p#]

but I'm getting 

ERROR: 'u-fail 
(invalid attempt to set "unique" attribute (list shouldn't contain duplicate values before setting `u# attribute))

the table is sorted by `sym`time, just need to apply the attribute.  Any ideas what I'm doing wrong here?

Thanks

6 REPLIES 6

CPCadogan
New Contributor
Is your data sorted on disk?

Try @[`sym xasc `:db/2014.12.01/tab;`sym;`p#]

I get the same error, also, I dont want to sort again really, because the table is sorted already and don't want it to take longer

Hmmm.... Not entirely sure then... 

It could be worth checking the enumeration of your sym column. It's possible the underlying values might be out of whack.

HTH

Thanks,  I'm upsertting directly to disk using something like

(`:/path/tab) upsert .Q.en[`:c😕db] tab)

hopefully my sym file is ok, I should'nt be able to see syms though I dont think, if it was messed up


hoffmanroni
New Contributor III
Yes I have `s attr on the sym col

I'm sorting on disk using this


`sym`time xasc (` sv  (`:e:/path, `$(string [d], "/tab")));


and then I'm compressing on disk using

-19!((` sv  (`:e:/path, `$(string [d], "/tab")));(` sv  (`:e:/path, `$(string [d], "/tab")));17;2;6);

does that look right?


I got sidetracked for a couple weeks 🙂 but yes it actually looks like the data for the dates that I was trying to apply the attribute to was corrupted somehow.  It works now that Im trying on new data.  Thanks again for the help.