2 weeks ago
I've noticed some weird behaviour with amend entire using lists of lists. The behaviour is different depending on whether on I use a file handle or pass the list directly to the function. Code to recreate is pasted below:
weirdPartition:(1 2 3f;();enlist 1 2 3);
file:`:./tester/weirdPartition;
file set weirdPartition;
addToWeirdPartition:(1 2 3f;4 5 6f);
// amend at?
// handle doesn't work? type error?
.[file;();,;addToWeirdPartition]
// in memory works?
.[get file;();,;addToWeirdPartition]
Anyone explain why it does not work with a handle?
2 weeks ago
I think this is due to the constraints specified here: https://code.kx.com/q/ref/amend/#on-disk, in particular that only vectors of types 1-19 can be updated directly on disk. Given that weirdPartition has type 0, it can't be updated on disk, but has no such constraints in memory.
Note: Personally unclear on whether the wording on the above link ("Certain vectors (types 1-19) can be updated directly on disk without the need to fully rewrite the file. ") means it can't be done, or it can be done but that the entire file must be rewritten, and there is another issue at play here. I'm leaning towards the former, and that modifications must be done in memory first before writing.
2 weeks ago
The weird thing for me is we have a process that writes in this fashion, running several times a day. In some cases, it fails (which makes sense given the explanation you have given), but it does work in some cases as well. might lean towards just re-architecting the datatypes for this table.
EMEA
Tel: +44 (0)28 3025 2242
AMERICAS
Tel: +1 (212) 447 6700
APAC
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.