KX Community

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

Home Forums kdb+ Using the partition type as a parameter Reply To: Using the partition type as a parameter

  • sujoy

    Member
    July 28, 2024 at 2:46 am

    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;datesym!datesym;(enlistcnt)!enlist (count;`i)]

    }