kdb:有没有办法有效地合并两个排序表?
假设我们有两个表都在 time
列上排序:
t1:`time xasc ([]time:5?100;v:5?1000)
t2:`time xasc ([]time:5?100;v:5?1000)
是否有一种有效的方法来获得与 `time xasc t1,t2
相同的结果,利用这两个表表格已经排序了吗?我查看了aj
,但我无法找到我需要的“合并两个表”功能。
Say we have two tables both sorted on the time
column:
t1:`time xasc ([]time:5?100;v:5?1000)
t2:`time xasc ([]time:5?100;v:5?1000)
Is there an efficient way to get the same result as `time xasc t1,t2
, using the fact that the two tables are already sorted? I looked at aj
but I wasn't able to find the "combine two tables" functionality I need here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
kdb 中没有本机合并排序/二进制排序,因此最佳可用方法是
asc x,y
。如果您沿着在 kdb 中复制合并/二进制排序的路径,那么您不太可能比本机asc x,y
更快地获得它。您也可以尝试用 C 编写合并/二进制排序并导入共享库以在 kdb 中使用There is no native merge-sort/binary-sort in kdb so the optimal available approach is
asc x,y
. If you go down the path of replicating a merge/binary sort in kdb then you're unlikely to get it faster than the nativeasc x,y
. You could alternatively try to write a merge/binary sort in C and import a shared library to use in kdb