

sujoy
Forum Replies Created
-
Your syntax is incorrect
{x!fills x} enlist
px!
px{x!fills,/:x} enlist
px</code><p><span style="font-size: 1rem;">px| ^\
px -
sujoy
MemberJuly 31, 2024 at 12:24 pm in reply to: Unintentionally replacing the new sym file with old one broke the dbIt won’t work. Indexing in sym file will be different.
The only way here to fix it will be to completely copy replica db to the current db.
-
The main issue here is changing the .Q.pf (date) value while running the function in scope. Resulting in the error.
Each select query runs, .Q.ps, and while evaluating the where clause, the partition field which is expected to be a list, becomes an atom and (&) fails with type error
When you enlist it, it will work because “where eval c” will always return 1b, which eventually translates into the first partition.
d@:&-6!*c
You can override it to work, if you still want to use it in the function
f:{[date;tab]
c:enlist (=;
date;date);
date:.Q.pv;
?[tab;c;date
sym!
datesym;(enlist
cnt)!enlist (count;`i)]}
-
<div>It seems to me, you need to break when the range is met.</div>
f:{1+1_first -2#{x,last where z=abs y[last x] - y}[;x;y]\ [{0<=last deltas -2#x};0]}
where (1+til count c)!c:deltas f[lastPrice;rangeTarget]
1 1 1 1 2 2 2 3 3 3 4 4 4
-
I think, read0 (0::) is reading 1 line at a time, while 0: is picking up columns. 0: will be faster, if you exactly know which position you are looking at.
-
sujoy
MemberJune 16, 2024 at 3:26 am in reply to: .z.pd function throwing error for non unique handlesYour function is using peach and setting -s -2, it is expecting handles on .z.pd, which is blank and hence failing.
Start your process
q -s 2
q).z.pd:
u#
int$()q).z.pd
u#
int$()q){x+til 2} peach til 2
0 1
1 2
q)\s -2
q){x+til 2} peach til 2
'.z.pd - expected unique vector of int handles
[0] {x+til 10} peach til 10
^
q))
-
sujoy
MemberJune 5, 2024 at 1:35 pm in reply to: Keeping data querable while processes are taking downhttps://code.kx.com/q/wp/socket-sharding/
code.kx.com
Set-up and use of socket sharding in kdb+, with several example scenarios
-
sujoy
MemberFebruary 8, 2024 at 12:00 am in reply to: How to notify RDB that there’s a new table in the tp that it can subscribe to?Based on your problem statement,
i would first ensure tp is sending the data as a table to subscriber’s and same is stored in tplog.
Next whenever TP has a new Table, tp should append the same in .u.w for each (or required) subscriber (rdb)
rdb on upd will simply insert. So a new table should appear without any data loss.
Thanks
Sujoy
-
The error represents “TRADE_DT” is not in the table. Most likely you are overriding “test” somewhere in the code, which does not have the column “TRADE_DT”.
As such the query has no issues, it should work.
-
sujoy
MemberAugust 5, 2023 at 12:00 am in reply to: Parallelising .Q.dpft with default compression enabledThis is cool. I also have used and created similar override to .Q.dpft. Use case is valid till 3.6.
If you use KX 4.0 with slaves, it internally is optimised to save data faster on disk (Probably some c code ). Something I did not find in the KX release notes.
In my tests, it will beat/match the peach override.
Many Thanks
Sujoy
-
sujoy
MemberJune 24, 2023 at 12:00 am in reply to: .Q.par Doesn’t Provide the Correct Result in the Segmented db.Seems like a case when entries were added in par.txt from possibly 3 to 8 without moving the partitions to correct locations. Only way to fix this is to move all the partitions to right locations.
These all will be giving inconsistent results
`l `bv `L `a2 `par `dpts `dpt `dpft `dpft `dsftg `chk
-
sujoy
MemberApril 17, 2023 at 12:00 am in reply to: How to walkthrough a tree and calculate value on path?Try to traverse through Dictionary
tree:([]parent:`A`A`A`B`B`E`E;child:`B`C`D`E`F`G`H;data:(1;2;3;4;5;6;7)); tree:([]parent:`A`A`A`B`B`E`E;child:`B`C`D`E`F`G`H;data:(1;2;3;4;5;6;7)); traverse_dict:exec child!parent from tree; calc:`A`D`C`B`F`E`G`H!1 3 2 1 5 4 6 7; traverse_func:{[st;end;dict;calc] prd calc except[(dict) end;(dict) st] }[;;traverse_dict;calc]; outputTree:([] parent:`A`A`A`A`A`B`B`B`E`E;child:`C`D`F`G`H`F`G`H`G`H); // output update val:traverse_func'[parent;child] from outputTree
-
If you refer here: https://code.kx.com/q/basics/syscmds/#l-load-file-or-directory
- serialized object, deserializes it into memory as variable
name
- directory of a splayed table, maps the table to variable
name
, without loading any columns into memory
When you are running, l .t -> you are loading the object as t in root. Thus .Q.qp is showing t as 0
% ls -lrth t
total 16
-rw-r–r– 1 sujoyrak**bleep** staff 40B Sep 17 17:20 v1
-rw-r–r– 1 sujoyrak**bleep** staff 40B Sep 17 17:20 v2% q
KDB+ 4.0 2021.07.12 Copyright (C) 1993-2021 Kx Systems
q)l .
q)a
,`t
q).Q.qp t
0b
q)l t
`t
q).Q.qp t
0 - serialized object, deserializes it into memory as variable
-
Apart from vector-based condition mentioned above, ? Will always run the fail condition unlike $.
$[1;2;err]
2 ?[1;2;err]
'err [0] ?[1;2;err]