You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/08/15 06:09:37 UTC
[GitHub] [inlong] yunqingmoswu opened a new pull request, #5543: [INLONG-5447][Sort] Add lookup support for Redis
yunqingmoswu opened a new pull request, #5543:
URL: https://github.com/apache/inlong/pull/5543
### Prepare a Pull Request
*(Change the title refer to the following example)*
Title: [INLONG-5447][Sort] Add lookup support for redis
*(The following *XYZ* should be replaced by the actual [GitHub Issue](https://github.com/apache/inlong/issues) number)*
Fixes #5447
### Motivation
I want to support lookup join with redis, so it is necessary to implement redis connector and support lookup query.
### Modifications
Sort will supports lookup for redis.
#### For Flink Table API
1. Add RedisDynamicTableSource, RedisRowDataLookupFunction, RedisDynamicTableFactory, SchemaValidator,RedisOptions, RedisLookupOptions
#### For Redis Client API
1. Add FlinkJedisStandaloneConfigHandler,
2. Update API of FlinkJedisClusterConfigHandler, FlinkJedisSentinelConfigHandler
3.Expand RedisCommandsContainer, RedisMapper, and etc.
### Verifying this change
*(Please pick either of the following options)*
- [ ] This change is a trivial rework/code cleanup without any test coverage.
- [x] This change is already covered by existing tests, such as:
*(please describe tests)*
- [ ] This change added tests and can be verified as follows:
*(example:)*
- *Added integration tests for end-to-end deployment with large payloads (10MB)*
- *Extended integration test for recovery after broker failure*
### Documentation
- Does this pull request introduce a new feature? (yes / no)
- If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
- If a feature is not applicable for documentation, explain why?
- If a feature is not documented yet in this PR, please create a follow-up issue for adding the documentation
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] yunqingmoswu commented on a diff in pull request #5543: [INLONG-5447][Sort] Add lookup support for Redis
Posted by GitBox <gi...@apache.org>.
yunqingmoswu commented on code in PR #5543:
URL: https://github.com/apache/inlong/pull/5543#discussion_r945455817
##########
inlong-sort/sort-connectors/redis/src/main/java/org/apache/inlong/sort/redis/source/RedisRowDataLookupFunction.java:
##########
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.sort.redis.source;
+
+import org.apache.flink.shaded.guava18.com.google.common.cache.Cache;
+import org.apache.flink.shaded.guava18.com.google.common.cache.CacheBuilder;
+import org.apache.flink.streaming.connectors.redis.common.config.FlinkJedisConfigBase;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.functions.FunctionContext;
+import org.apache.flink.table.functions.TableFunction;
+import org.apache.inlong.sort.redis.common.config.RedisLookupOptions;
+import org.apache.inlong.sort.redis.common.container.InlongRedisCommandsContainer;
+import org.apache.inlong.sort.redis.common.container.RedisCommandsContainerBuilder;
+import org.apache.inlong.sort.redis.common.mapper.RedisCommand;
+import org.apache.inlong.sort.redis.common.mapper.RedisCommandDescription;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Redis RowData lookup function
+ */
+public class RedisRowDataLookupFunction extends TableFunction<RowData> {
+
+ private static final Logger LOG = LoggerFactory.getLogger(RedisRowDataLookupFunction.class);
+
Review Comment:
done
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] yunqingmoswu commented on pull request #5543: [INLONG-5447][Sort] Add lookup support for Redis
Posted by GitBox <gi...@apache.org>.
yunqingmoswu commented on PR #5543:
URL: https://github.com/apache/inlong/pull/5543#issuecomment-1216101875
> please change the `1.1-SNAPSHOT` to a stable version.
done
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] yunqingmoswu commented on a diff in pull request #5543: [INLONG-5447][Sort] Add lookup support for Redis
Posted by GitBox <gi...@apache.org>.
yunqingmoswu commented on code in PR #5543:
URL: https://github.com/apache/inlong/pull/5543#discussion_r945459329
##########
pom.xml:
##########
@@ -212,6 +212,7 @@
<flink.protobuf.version>2.7.6</flink.protobuf.version>
<flink.connector.mongodb.cdc.version>2.2.1</flink.connector.mongodb.cdc.version>
<flink.connector.oracle.cdc.version>2.2.1</flink.connector.oracle.cdc.version>
+ <flink.connector.redis>1.1-SNAPSHOT</flink.connector.redis>
Review Comment:
This is a stable version, but the version name is SNAPSHOT.
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] healchow commented on a diff in pull request #5543: [INLONG-5447][Sort] Add lookup support for Redis
Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #5543:
URL: https://github.com/apache/inlong/pull/5543#discussion_r945450761
##########
inlong-sort/sort-connectors/redis/src/main/java/org/apache/inlong/sort/redis/common/container/InlongRedisClusterContainer.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.sort.redis.common.container;
+
+import org.apache.flink.streaming.connectors.redis.common.container.RedisClusterContainer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import redis.clients.jedis.JedisCluster;
+
+/**
+ * The redis cluster contain expand from {@link RedisClusterContainer}
+ */
+public class InlongRedisClusterContainer extends RedisClusterContainer implements InlongRedisCommandsContainer {
+
+ private static final Logger LOG = LoggerFactory.getLogger(InlongRedisClusterContainer.class);
+
+ private final transient JedisCluster jedisCluster;
+
+ public InlongRedisClusterContainer(JedisCluster jedisCluster) {
+ super(jedisCluster);
+ this.jedisCluster = jedisCluster;
+ }
+
+ @Override
+ public void del(String key) {
+ try {
+ jedisCluster.del(key);
+ } catch (Exception e) {
+ if (LOG.isErrorEnabled()) {
Review Comment:
In development and production environments, it is recommended to turn on error-level logs. So is there no need to judge `isErrorEnabled`?
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] healchow commented on a diff in pull request #5543: [INLONG-5447][Sort] Add lookup support for Redis
Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #5543:
URL: https://github.com/apache/inlong/pull/5543#discussion_r945456597
##########
inlong-sort/sort-connectors/redis/src/main/java/org/apache/inlong/sort/redis/common/container/InlongRedisClusterContainer.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.sort.redis.common.container;
+
+import org.apache.flink.streaming.connectors.redis.common.container.RedisClusterContainer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import redis.clients.jedis.JedisCluster;
+
+/**
+ * The redis cluster contain expand from {@link RedisClusterContainer}
+ */
+public class InlongRedisClusterContainer extends RedisClusterContainer implements InlongRedisCommandsContainer {
+
+ private static final Logger LOG = LoggerFactory.getLogger(InlongRedisClusterContainer.class);
+
+ private final transient JedisCluster jedisCluster;
+
+ public InlongRedisClusterContainer(JedisCluster jedisCluster) {
+ super(jedisCluster);
+ this.jedisCluster = jedisCluster;
+ }
+
+ @Override
+ public void del(String key) {
+ try {
+ jedisCluster.del(key);
+ } catch (Exception e) {
+ if (LOG.isErrorEnabled()) {
Review Comment:
Okay, for the time being, keep it consistent with the source code.
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] dockerzhang merged pull request #5543: [INLONG-5447][Sort] Add lookup support for Redis
Posted by GitBox <gi...@apache.org>.
dockerzhang merged PR #5543:
URL: https://github.com/apache/inlong/pull/5543
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] yunqingmoswu commented on a diff in pull request #5543: [INLONG-5447][Sort] Add lookup support for Redis
Posted by GitBox <gi...@apache.org>.
yunqingmoswu commented on code in PR #5543:
URL: https://github.com/apache/inlong/pull/5543#discussion_r945455340
##########
inlong-sort/sort-connectors/redis/src/main/java/org/apache/inlong/sort/redis/common/container/InlongRedisClusterContainer.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.sort.redis.common.container;
+
+import org.apache.flink.streaming.connectors.redis.common.container.RedisClusterContainer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import redis.clients.jedis.JedisCluster;
+
+/**
+ * The redis cluster contain expand from {@link RedisClusterContainer}
+ */
+public class InlongRedisClusterContainer extends RedisClusterContainer implements InlongRedisCommandsContainer {
+
+ private static final Logger LOG = LoggerFactory.getLogger(InlongRedisClusterContainer.class);
+
+ private final transient JedisCluster jedisCluster;
+
+ public InlongRedisClusterContainer(JedisCluster jedisCluster) {
+ super(jedisCluster);
+ this.jedisCluster = jedisCluster;
+ }
+
+ @Override
+ public void del(String key) {
+ try {
+ jedisCluster.del(key);
+ } catch (Exception e) {
+ if (LOG.isErrorEnabled()) {
Review Comment:
It is copy from the origin source code.
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] dockerzhang commented on pull request #5543: [INLONG-5447][Sort] Add lookup support for Redis
Posted by GitBox <gi...@apache.org>.
dockerzhang commented on PR #5543:
URL: https://github.com/apache/inlong/pull/5543#issuecomment-1216086877
please change the `1.1-SNAPSHOT` to a stable version.
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] EMsnap commented on a diff in pull request #5543: [INLONG-5447][Sort] Add lookup support for Redis
Posted by GitBox <gi...@apache.org>.
EMsnap commented on code in PR #5543:
URL: https://github.com/apache/inlong/pull/5543#discussion_r945458728
##########
pom.xml:
##########
@@ -212,6 +212,7 @@
<flink.protobuf.version>2.7.6</flink.protobuf.version>
<flink.connector.mongodb.cdc.version>2.2.1</flink.connector.mongodb.cdc.version>
<flink.connector.oracle.cdc.version>2.2.1</flink.connector.oracle.cdc.version>
+ <flink.connector.redis>1.1-SNAPSHOT</flink.connector.redis>
Review Comment:
no stable version of redis connetor ?
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [inlong] healchow commented on a diff in pull request #5543: [INLONG-5447][Sort] Add lookup support for Redis
Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #5543:
URL: https://github.com/apache/inlong/pull/5543#discussion_r945452791
##########
inlong-sort/sort-connectors/redis/src/main/java/org/apache/inlong/sort/redis/source/RedisRowDataLookupFunction.java:
##########
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.inlong.sort.redis.source;
+
+import org.apache.flink.shaded.guava18.com.google.common.cache.Cache;
+import org.apache.flink.shaded.guava18.com.google.common.cache.CacheBuilder;
+import org.apache.flink.streaming.connectors.redis.common.config.FlinkJedisConfigBase;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.functions.FunctionContext;
+import org.apache.flink.table.functions.TableFunction;
+import org.apache.inlong.sort.redis.common.config.RedisLookupOptions;
+import org.apache.inlong.sort.redis.common.container.InlongRedisCommandsContainer;
+import org.apache.inlong.sort.redis.common.container.RedisCommandsContainerBuilder;
+import org.apache.inlong.sort.redis.common.mapper.RedisCommand;
+import org.apache.inlong.sort.redis.common.mapper.RedisCommandDescription;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Redis RowData lookup function
+ */
+public class RedisRowDataLookupFunction extends TableFunction<RowData> {
+
+ private static final Logger LOG = LoggerFactory.getLogger(RedisRowDataLookupFunction.class);
+
Review Comment:
No need for more than one blank line.
--
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org