KX Community

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

Home Forums kdb+ KDB table with an array as element Re: KDB table with an array as element

  • darrenwsun

    Member
    August 19, 2022 at 12:00 am

    Both works, as (()) is interpreted the same as (). For this reason the first form is preferred. Note that the data type of price is determined by the data type of cell in the first row.

     

    q)t:([] time:`time$(); price:()) 
    q)meta t 
    c    | t f a 
    -----| ----- 
    time | t 
    price| 
    
    q)`t upsert (.z.t; 10 11f) `t 
    q)t 
    time price 
    ------------------ 
    21:42:07.028 10 11 
    
    q)meta t 
    c    | t f a 
    -----| ----- 
    time | t 
    price| F 
    
    q)`t upsert (.z.t; 10 11) `t 
    q)t 
    time price 
    ------------------ 
    21:42:07.028 10 11 
    21:44:30.724 10 11 
    
    q)meta t 
    c    | t f a 
    -----| ----- 
    time | t 
    price| F