범위 쿼리에 대해 스트림 UDF를 작성했지만 제대로 작동하지 않습니다. 루아로 많은 필터를 설정하는 방법을 알고 계신가요? 범위에 대한 Aerospike 스트림 UDF 작성 방법 쿼리
쿼리 :stmt = new Statement();
stmt.setNamespace(dbid);
stmt.setSetName("links");
stmt.setIndexName("time");
stmt.setFilters(Filter.range("time", minTimestamp, maxTimestamp));
stmt.setAggregateFunction("linkbench", "check_id1", Value.get(id1));
stmt.setAggregateFunction("linkbench", "check_linktype", Value.get(link_type));
resultSet = client.queryAggregate(null, stmt, "linkbench", "check_visibility", Value.get(VISIBILITY_DEFAULT));
루아 스크립트 :
local function map_links(record)
-- Add user and password to returned map.
-- Could add other record bins here as well.
return record.id2
end
function check_id1(stream,id1)
local function filter_id1(record)
return record.id1 == id1
end
return stream : filter(filter_id1) : map(map_links)
end
function check_linktype(stream,link_type)
local function filter_linktype(record)
return record.link_type == link_type
end
return stream : filter(filter_linktype) : map(map_links)
end
function check_visibility(stream,visibility)
local function filter_visibility(record)
return record.visibility == visibility
end
return stream : filter(filter_visibility) : map(map_links)
end
어떤 생각이 어떻게 모든 쿼리에 대한 필터를 작성하는 방법이 루아 함수를 호출하는
SELECT id1, id2, link_type, visibility, data, time, version FROM linktable
WHERE id1 = <id1> AND
link_type = <link_type> AND
time >= <minTime> AND
time <= <maxTimestamp> AND
visibility = VISIBILITY_DEFAULT
ORDER BY time DESC LIMIT <offset>, <limit>;
자바 코드 제한 사항?
감사합니다.
동시에 다음 사이트에서 논의됩니다. https://discuss.aerospike.com/t/record-manipulation-with-more-than-one-filter-lua/3637 – pgupta