TyrantLucifer commented on code in PR #5570:
URL: https://github.com/apache/seatunnel/pull/5570#discussion_r1345262624


##########
docs/en/connector-v2/sink/Redis.md:
##########
@@ -20,6 +20,7 @@ Used to write data to Redis.
 | data_type      | string | yes                   | -             |
 | user           | string | no                    | -             |
 | auth           | string | no                    | -             |
+| db_num         | int    | no                    | -             |

Review Comment:
   ```suggestion
   | db_num         | int    | no                    | 0            |
   ```



##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/RedisParameters.java:
##########
@@ -40,6 +40,7 @@ public class RedisParameters implements Serializable {
     private String host;
     private int port;
     private String auth = "";
+    private Integer dbNum;

Review Comment:
   ```suggestion
       private int dbNum;
   ```



##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/RedisParameters.java:
##########
@@ -148,7 +156,11 @@ public Jedis buildJedis() {
                 } else {
                     jedisCluster = new JedisCluster(nodes);
                 }
-                return new JedisWrapper(jedisCluster);
+                JedisWrapper jedisWrapper = new JedisWrapper(jedisCluster);
+                if (dbNum != null && dbNum > 0) {
+                    jedisWrapper.select(dbNum);

Review Comment:
   The same as above.



##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/RedisParameters.java:
##########
@@ -115,6 +120,9 @@ public Jedis buildJedis() {
                 if (StringUtils.isNotBlank(user)) {
                     jedis.aclSetUser(user);
                 }
+                if (dbNum != null && dbNum > 0) {
+                    jedis.select(dbNum);
+                }

Review Comment:
   ```suggestion
                       jedis.select(dbNum);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to