簡體   English   中英

Aerospike-使用多個過濾器查詢

[英]Aerospike - Query with Multiple Filters

我正在嘗試使用多個過濾器來查詢Aerospike,這些過濾器取自下面提到的鏈接的參考...

https://www.aerospike.com/community/labs/query_multiple_filters.html

在上述線程中提出的示例中,正在使用的Aerospike客戶端版本為3.0.22,我在項目中使用的是3.0.0版本。 我可以查詢數據庫並通過在Aerospike網站上更改上述示例來檢索所需的數據,但是當我在項目中運行相同的代碼時,不會返回任何數據。

版本3.0.0不支持lua腳本和用於數據檢索的聚合函數嗎? 如果是,是否還有其他方法可以在3.0.0版中進行查詢?

Lua腳本

local function map_order(record)
return map {key=record.key, mid=record.mid, orderId=record.orderId, amount=record.amount}
end

function filter_order(stream, mid)
  local function filter_mid(record)
    return record.mid == mid
  end

  return stream : filter(filter_mid) : map(map_order)

end

數據檢索碼

ResultSet resultSet = client.queryAggregate(null, stmt, "profile", "filter_order", Value.get("mid334"));

編輯:獲取此異常

com.aerospike.client.AerospikeException: Failed to read file: /home/lalit/spring-suite/sts-bundle/sts-3.6.3.RELEASE/udf/profile.lua

當文件位於/home/lalit/udf/profile.udf

用於注冊lua文件的代碼

 LuaConfig.SourceDirectory = "udf";
 udfFile = new File("/home/lalit/udf/profile.lua");
 task = client.getAerospikeClient().register(null, udfFile.getPath(), udfFile.getName(), Language.LUA); 
 task.waitTillComplete();

設法解決它。

QueryAggregateExecutor的run方法從文件系統加載lua函數,該文件系統使用LuaConfig.SourceDirectory變量來定位腳本文件的路徑。

我正在通過udf

LuaConfig.SourceDirectory = "udf"

應該是/ home / lalit / udf

LuaConfig.SourceDirectory = "/home/lalit/udf"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM