我有一个nodejs和aerospike设置。我想知道如何运行查询Bin1 == Bin2
。
在SQL中
SELECT * FROM [test]t where t.EmployeeId == t.shipperid
可以吗?我总是可以查询test
集中的所有值,并在nodejs中对其进行过滤。但是我认为这将是非常低效的。如果有一种以空中加速的方式,请告诉我吗?
答案 0 :(得分:1)
您可以创建一个额外的bin Function Install-Font {
Param (
[Parameter(Mandatory=$true,ValueFromPipeline=$true)][System.IO.FileSystemInfo[]]$File
)
$shell = New-Object -ComObject Shell.Application
$File | % {
$Fonts = $shell.NameSpace($_.Directory.Name)
$font = $Fonts.ParseName($_.Name)
$font.InvokeVerb("Install")
}
}
,当ID相等时设置为true。这个bin有一个二级索引。然后,您可以对"equal_ids"
答案 1 :(得分:0)
现有的query谓词不支持此功能,但您可以将其表示为stream UDF。
local function bin_match_filter(bin1, bin2)
return function(rec)
if rec[bin1] and rec[bin2] and
(type(rec[bin1]) == type(rec[bin2])) and
rec[bin1] == rec[bin2] then
return true
end
return false
end
end
local function map_record(rec)
local ret = map()
for i, bin_name in ipairs(record.bin_names(rec)) do
ret[bin_name] = rec[bin_name]
end
return ret
end
function check_bins_match(stream, bin1, bin2)
return stream : filter(bin_match_filter(bin1, bin2)) : map(map_record)
end
您现在可以运行与secondary index查询匹配的记录,或通过此流UDF进行扫描。