Table 列定义
Table cols definition
kdb+ 中使用了很多技巧来处理 keyed/splayed/partitioned 和简单的表。我看到很多 .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
]}
用于字典:
q)cols`a`b`c!1 2 3
`a`b`c
其中键 (!
) 的类型 (@
) 是符号列表 (11h
)
kdb+ 中使用了很多技巧来处理 keyed/splayed/partitioned 和简单的表。我看到很多 .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
]}
用于字典:
q)cols`a`b`c!1 2 3
`a`b`c
其中键 (!
) 的类型 (@
) 是符号列表 (11h
)