Java Code Examples for redis.clients.jedis.Jedis#zscan()

The following examples show how to use redis.clients.jedis.Jedis#zscan() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RedisRecordHandler.java    From aws-athena-query-federation with Apache License 2.0 6 votes vote down vote up
private void loadZSetRows(Jedis client, String keyString, BlockSpiller spiller, List<Field> fieldList)
{
    if (fieldList.size() != 1) {
        throw new RuntimeException("Ambiguous field mapping, more than 1 field for ZSET value type.");
    }

    Field zfield = fieldList.get(0);
    String cursor = SCAN_POINTER_START;
    do {
        ScanResult<Tuple> result = client.zscan(keyString, cursor);
        cursor = result.getCursor();
        for (Tuple nextElement : result.getResult()) {
            spiller.writeRows((Block block, int rowNum) -> {
                Object zvalue = ValueConverter.convert(zfield, nextElement.getElement());
                boolean zsetMatched = block.offerValue(KEY_COLUMN_NAME, rowNum, keyString);
                zsetMatched &= block.offerValue(zfield.getName(), rowNum, zvalue);
                return zsetMatched ? 1 : 0;
            });
        }
    }
    while (cursor != null && !END_CURSOR.equals(cursor));
}
 
Example 2
Source File: DefaultRedis.java    From craft-atom with MIT License 5 votes vote down vote up
private ScanResult<Map.Entry<String, Double>> zscan_match_count(Jedis j, String key, String cursor, String pattern, int count) {
	ScanParams param = new ScanParams();
	param.match(pattern);
	param.count(count);
	redis.clients.jedis.ScanResult<Tuple> sr = j.zscan(key, cursor, param);
	return new ScanResult<Map.Entry<String, Double>>(sr.getStringCursor(), convert(sr.getResult()));
}
 
Example 3
Source File: DefaultRedis.java    From craft-atom with MIT License 4 votes vote down vote up
private ScanResult<Map.Entry<String, Double>> zscan0(Jedis j, String key, String cursor) {
	redis.clients.jedis.ScanResult<Tuple> sr = j.zscan(key, cursor);
	return new ScanResult<Map.Entry<String, Double>>(sr.getStringCursor(), convert(sr.getResult()));
}
 
Example 4
Source File: DefaultRedis.java    From craft-atom with MIT License 4 votes vote down vote up
private ScanResult<Map.Entry<String, Double>> zscan_count(Jedis j, String key, String cursor, int count) {
	ScanParams param = new ScanParams();
	param.count(count);
	redis.clients.jedis.ScanResult<Tuple> sr = j.zscan(key, cursor, param);
	return new ScanResult<Map.Entry<String, Double>>(sr.getStringCursor(), convert(sr.getResult()));
}
 
Example 5
Source File: DefaultRedis.java    From craft-atom with MIT License 4 votes vote down vote up
private ScanResult<Map.Entry<String, Double>> zscan_match(Jedis j, String key, String cursor, String pattern) {
	ScanParams param = new ScanParams();
	param.match(pattern);
	redis.clients.jedis.ScanResult<Tuple> sr = j.zscan(key, cursor, param);
	return new ScanResult<Map.Entry<String, Double>>(sr.getStringCursor(), convert(sr.getResult()));
}
 
Example 6
Source File: Zscan.java    From tutorials with MIT License 4 votes vote down vote up
@Override
public ScanResult<Tuple> scan(Jedis jedis, String cursor, ScanParams scanParams) {
    return jedis.zscan(key, cursor, scanParams);
}