[英]Intersection between two tables in DolphinDB server
I'm trying to use the intersection
function in DolphinDB as follows:我正在尝试在 DolphinDB 中使用
intersection
function 如下:
n=1000000
ID=rand(100, n)
dates=2017.08.07..2017.08.11
date=rand(dates, n)
x=rand(10.0, n)
t=table(ID, date, x)
dbDate = database(, VALUE, 2017.08.07..2017.09.11)
dbID = database(, RANGE, 0 50 100)
db = database("dfs://compodb", COMPO, [dbDate, dbID])
pt = db.createPartitionedTable(t, `pt, `date`ID).append!(t)
dfsTable=loadTable("dfs://compodb","pt")
A = select * from dfsTable where date = 2017.08.07
B = select * from dfsTable where date = 2017.08.08
intersection(A[`x],B[`x])
But I am getting the error:但我收到错误:
The both arguments for 'bitAnd'(&) must be integers
Apparently something doesn't work in this query... any idea?显然有些东西在这个查询中不起作用......有什么想法吗?
This document section says this about how to create a vector:本文档部分说明了如何创建向量:
- A vector from a table column.
来自表列的向量。 For example, trades.qty indicates column qty from table trades.
例如,trades.qty 表示交易表中的列 qty。
And it looks like intersection
is an alias for &
, which for vectors is treated as bitAnd
, as said here :看起来
intersection
是&
的别名,对于向量,它被视为bitAnd
,如此处所述:
Arguments
Arguments
- Set Operation: X and Y are sets.
集合操作:X 和 Y 是集合。
- Bit Operation: X and Y are equal sized vectors, or Y is a scalar.
位运算:X 和 Y 是大小相等的向量,或者 Y 是标量。
So you need to convert vector to set with set(A[`x])
function .所以你需要将向量转换为
set(A[`x])
function 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.