KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ .Q.hdpf throws ` type Error. Re: .Q.hdpf throws ` type Error.

  • davidcrossey

    Member
    November 29, 2021 at 12:00 am

    I’m not certain, but using a simple example, column order in .d file doesn’t appear to impact the operation of .Q.dpft (which is called by .Q.hdpf):

    q)get hsym `$"./2021.11.25/t/.d" 
    `sym`qty`price 
    
    q)get hsym `$"./2021.11.26/t/.d" 
    `sym`price`qty 
    q)\l . 
    q)t 
    date       sym  price   qty 
    ---------------------------- 
    2021.11.25 akjl 90.30751 2 
    2021.11.25 amge 91.49882 33 
    2021.11.26 jobl 64.2737  39 
    2021.11.26 lfjp 38.69818 48

    One can check through the definition of .Q.hdpf to see what it’s doing; granted it’s implemented in k), however you can see some clear parts:

    q).Q.hdpf 
    k){[h;d;p;f](@[`.;;0#]dpft[d;p;f]@)'t@>(#.:)'t:.q.tables`.;if[h:@[hopen;h;0];h"\l .";>h]}

    which as per link in my initial response aligns to this statement of 3 parts:

    “Saves all tables by calling .Q.dpft, clears tables, and sends reload message to HDB.”

    The question to ask yourself is where is it failing?

    If the data is being saved to your HDB then it’s getting past the .Q.dpft call. The type error could be coming from the reload, where you RDB is trying to reload the HDB via handle ‘h’. Are you passing an HDB handle to your process as the first parameter, is that handle valid etc