首页 > 解决方案 > 表列定义

问题描述

kdb+ 中使用了许多技巧来处理键控/展开/分区和简单的表。我看到许多.Q功能作为这些品种的外观。其中之一是cols。你能帮我处理一个案例吗?这个11h=案例代表什么?

cols
k){$[
  .Q.qp x:.Q.v x; / If partitioned
  .Q.pf,!+x;      /   add "partitioned field" to table cols
  98h=@x;         / If simple table
  !+x;            /   just table cols (convert to dict of lists, get keys)
  11h=@!x;        / ?
  !x;
  !+0!x           / (keys-dict)!(data-dict): remove keys, get table cols
  ]}

标签: kdbk

解决方案


它适用于字典:

q)cols`a`b`c!1 2 3
`a`b`c

其中@键 ( ) 的类型 ( !) 是符号列表 ( 11h)


推荐阅读