在DolphinDB中使用intersection()函数遇到的问题

我想使用DolphinDB中的intersection()函数,返回两个集合的交集。
代码如下:

login("admin","123456")
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)

if(existsDatabase("dfs://compodb")){
    dropDatabase("dfs://compodb")
}

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)
pt.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])

返回如下错误:

The both arguments for 'bitAnd'(&) must be integers

请问哪里不对?

请先 登录 后评论

1 个回答

J0001

intersection(X, Y)的参数X和Y须是集合:

intersection(set(A[`x]),set(B[`x]))
请先 登录 后评论