Skip to content

Commit

Permalink
Minor improvement to Redis
Browse files Browse the repository at this point in the history
* Remove unused argument from RedisJedisManager
* Remove unused constructor from RedisQueryRunner
* Use closeAfterClass method in tests
* Add final in TestingRedisPlugin
  • Loading branch information
ebyhr committed May 10, 2022
1 parent 52e7e81 commit f16c90a
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import io.airlift.log.Logger;
import io.trino.spi.HostAddress;
import io.trino.spi.NodeManager;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

Expand All @@ -42,9 +41,7 @@ public class RedisJedisManager
private final JedisPoolConfig jedisPoolConfig;

@Inject
RedisJedisManager(
RedisConnectorConfig redisConnectorConfig,
NodeManager nodeManager)
RedisJedisManager(RedisConnectorConfig redisConnectorConfig)
{
this.redisConnectorConfig = requireNonNull(redisConnectorConfig, "redisConnectorConfig is null");
this.jedisPoolConfig = new JedisPoolConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*/
package io.trino.plugin.redis;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import io.airlift.json.JsonCodec;
import io.airlift.log.Logger;
Expand Down Expand Up @@ -47,12 +46,6 @@ private RedisQueryRunner() {}
private static final Logger log = Logger.get(RedisQueryRunner.class);
private static final String TPCH_SCHEMA = "tpch";

public static DistributedQueryRunner createRedisQueryRunner(RedisServer redisServer, String dataFormat, TpchTable<?>... tables)
throws Exception
{
return createRedisQueryRunner(redisServer, ImmutableMap.of(), dataFormat, ImmutableList.copyOf(tables));
}

public static DistributedQueryRunner createRedisQueryRunner(
RedisServer redisServer,
Map<String, String> extraProperties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class TestRedisConnectorTest
protected QueryRunner createQueryRunner()
throws Exception
{
RedisServer redisServer = new RedisServer();
RedisServer redisServer = closeAfterClass(new RedisServer());
return createRedisQueryRunner(redisServer, ImmutableMap.of(), "string", REQUIRED_TPCH_TABLES);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,17 @@
import io.trino.plugin.redis.util.RedisServer;
import io.trino.testing.AbstractTestQueries;
import io.trino.testing.QueryRunner;
import org.testng.annotations.AfterClass;

import static io.trino.plugin.redis.RedisQueryRunner.createRedisQueryRunner;

public class TestRedisDistributedHash
extends AbstractTestQueries
{
private RedisServer redisServer;

@Override
protected QueryRunner createQueryRunner()
throws Exception
{
redisServer = new RedisServer();
RedisServer redisServer = closeAfterClass(new RedisServer());
return createRedisQueryRunner(redisServer, ImmutableMap.of(), "hash", REQUIRED_TPCH_TABLES);
}

@AfterClass(alwaysRun = true)
public void destroy()
{
redisServer.close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class TestRedisLatestConnectorTest
protected QueryRunner createQueryRunner()
throws Exception
{
RedisServer redisServer = new RedisServer(LATEST_VERSION);
RedisServer redisServer = closeAfterClass(new RedisServer(LATEST_VERSION));
return createRedisQueryRunner(redisServer, ImmutableMap.of(), "string", REQUIRED_TPCH_TABLES);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
public class TestingRedisPlugin
extends RedisPlugin
{
private Map<SchemaTableName, RedisTableDescription> tableDescription;
private final Map<SchemaTableName, RedisTableDescription> tableDescription;

public TestingRedisPlugin(Map<SchemaTableName, RedisTableDescription> tableDescription)
{
Expand Down

0 comments on commit f16c90a

Please sign in to comment.