You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@bahir.apache.org by GitBox <gi...@apache.org> on 2022/07/09 08:39:22 UTC

[GitHub] [bahir-flink] collabH commented on a diff in pull request #149: [BAHIR-305] Kudu Flink SQL Support DynamicSource/Sink&LookupFunction

collabH commented on code in PR #149:
URL: https://github.com/apache/bahir-flink/pull/149#discussion_r917243261


##########
flink-connector-kudu/src/main/java/org/apache/flink/connectors/kudu/table/dynamic/KuduDynamicTableSourceSinkFactory.java:
##########
@@ -0,0 +1,243 @@
+/*
+ * 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.flink.connectors.kudu.table.dynamic;
+
+import org.apache.flink.configuration.ConfigOption;
+import org.apache.flink.configuration.ConfigOptions;
+import org.apache.flink.configuration.ReadableConfig;
+import org.apache.flink.connectors.kudu.connector.KuduTableInfo;
+import org.apache.flink.connectors.kudu.connector.reader.KuduReaderConfig;
+import org.apache.flink.connectors.kudu.connector.writer.KuduWriterConfig;
+import org.apache.flink.connectors.kudu.table.function.lookup.KuduLookupOptions;
+import org.apache.flink.connectors.kudu.table.utils.KuduTableUtils;
+import org.apache.flink.table.api.TableSchema;
+import org.apache.flink.table.connector.sink.DynamicTableSink;
+import org.apache.flink.table.connector.source.DynamicTableSource;
+import org.apache.flink.table.factories.DynamicTableSinkFactory;
+import org.apache.flink.table.factories.DynamicTableSourceFactory;
+import org.apache.flink.table.factories.FactoryUtil;
+import org.apache.kudu.shaded.com.google.common.collect.Sets;
+
+import java.util.Optional;
+import java.util.Set;
+
+/**
+ * Factory for creating configured instances of {@link KuduDynamicTableSource}/{@link KuduDynamicTableSink} in
+ * a stream environment.
+ */
+public class KuduDynamicTableSourceSinkFactory implements DynamicTableSourceFactory, DynamicTableSinkFactory {
+    public static final String IDENTIFIER = "kudu";
+    public static final ConfigOption<String> KUDU_TABLE = ConfigOptions
+            .key("kudu.table")
+            .stringType()
+            .noDefaultValue()
+            .withDescription("kudu's table name");
+
+    public static final ConfigOption<String> KUDU_MASTERS =
+            ConfigOptions
+                    .key("kudu.masters")
+                    .stringType()
+                    .noDefaultValue()
+                    .withDescription("kudu's master server address");
+
+
+    public static final ConfigOption<String> KUDU_HASH_COLS =
+            ConfigOptions
+                    .key("kudu.hash-columns")
+                    .stringType()
+                    .noDefaultValue()
+                    .withDescription("kudu's hash columns");
+
+    public static final ConfigOption<Integer> KUDU_REPLICAS =
+            ConfigOptions
+                    .key("kudu.replicas")
+                    .intType()
+                    .defaultValue(3)
+                    .withDescription("kudu's replica nums");
+
+    public static final ConfigOption<Integer> KUDU_MAX_BUFFER_SIZE =
+            ConfigOptions
+                    .key("kudu.max-buffer-size")
+                    .intType()
+                    .noDefaultValue()
+                    .withDescription("kudu's max buffer size");
+
+    public static final ConfigOption<Integer> KUDU_FLUSH_INTERVAL =
+            ConfigOptions
+                    .key("kudu.flush-interval")
+                    .intType()
+                    .noDefaultValue()
+                    .withDescription("kudu's data flush interval");
+
+    public static final ConfigOption<Long> KUDU_OPERATION_TIMEOUT =
+            ConfigOptions
+                    .key("kudu.operation-timeout")
+                    .longType()
+                    .noDefaultValue()
+                    .withDescription("kudu's operation timeout");
+
+    public static final ConfigOption<Boolean> KUDU_IGNORE_NOT_FOUND =
+            ConfigOptions
+                    .key("kudu.ignore-not-found")
+                    .booleanType()
+                    .noDefaultValue()
+                    .withDescription("if true, ignore all not found rows");
+
+    public static final ConfigOption<Boolean> KUDU_IGNORE_DUPLICATE =
+            ConfigOptions
+                    .key("kudu.ignore-not-found")
+                    .booleanType()
+                    .noDefaultValue()
+                    .withDescription("if true, ignore all dulicate rows");
+
+    /**
+     * hash partition bucket nums
+     */
+    public static final ConfigOption<Integer> KUDU_HASH_PARTITION_NUMS =
+            ConfigOptions
+                    .key("kudu.hash-partition-nums")
+                    .intType()
+                    .defaultValue(KUDU_REPLICAS.defaultValue() * 2)
+                    .withDescription("kudu's hash partition bucket nums,defaultValue is 2 * replica nums");
+
+    public static final ConfigOption<String> KUDU_PRIMARY_KEY_COLS =
+            ConfigOptions
+                    .key("kudu.primary-key-columns")
+                    .stringType()
+                    .noDefaultValue()
+                    .withDescription("kudu's primary key,primary key must be ordered");

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: reviews-unsubscribe@bahir.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org