Skip to content

Commit f3a45cd

Browse files
authored
[improve] qdrant options (#9235)
1 parent 734da06 commit f3a45cd

File tree

9 files changed

+65
-26
lines changed

9 files changed

+65
-26
lines changed

seatunnel-ci-tools/src/test/java/org/apache/seatunnel/api/ConnectorOptionCheckTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,13 @@ private Set<String> buildWhiteList() {
199199
whiteList.add("MongodbSinkOptions");
200200
whiteList.add("SlsSourceOptions");
201201
whiteList.add("SentrySinkOptions");
202-
whiteList.add("QdrantSinkOptions");
203202
whiteList.add("RocketMqSinkOptions");
204203
whiteList.add("SocketSinkOptions");
205204
whiteList.add("SelectDBSinkOptions");
206205
whiteList.add("RocketMqSourceOptions");
207206
whiteList.add("TablestoreSinkOptions");
208207
whiteList.add("TableStoreDBSourceOptions");
209208
whiteList.add("Neo4jSourceOptions");
210-
whiteList.add("QdrantSourceOptions");
211209
whiteList.add("SocketSourceOptions");
212210
whiteList.add("PostgresIncrementalSourceOptions");
213211
whiteList.add("SqlServerIncrementalSourceOptions");
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919

2020
import org.apache.seatunnel.api.configuration.Option;
2121
import org.apache.seatunnel.api.configuration.Options;
22+
import org.apache.seatunnel.api.options.ConnectorCommonOptions;
2223

23-
public class QdrantConfig {
24+
public class QdrantBaseOptions extends ConnectorCommonOptions {
2425

2526
public static final String CONNECTOR_IDENTITY = "Qdrant";
2627

seatunnel-connectors-v2/connector-qdrant/src/main/java/org/apache/seatunnel/connectors/seatunnel/qdrant/config/QdrantParameters.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ public class QdrantParameters implements Serializable {
3434
private boolean useTls;
3535

3636
public QdrantParameters(ReadonlyConfig config) {
37-
this.host = config.get(QdrantConfig.HOST);
38-
this.port = config.get(QdrantConfig.PORT);
39-
this.apiKey = config.get(QdrantConfig.API_KEY);
40-
this.collectionName = config.get(QdrantConfig.COLLECTION_NAME);
41-
this.useTls = config.get(QdrantConfig.USE_TLS);
37+
this.host = config.get(QdrantBaseOptions.HOST);
38+
this.port = config.get(QdrantBaseOptions.PORT);
39+
this.apiKey = config.get(QdrantBaseOptions.API_KEY);
40+
this.collectionName = config.get(QdrantBaseOptions.COLLECTION_NAME);
41+
this.useTls = config.get(QdrantBaseOptions.USE_TLS);
4242
}
4343

4444
public QdrantClient buildQdrantClient() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.seatunnel.connectors.seatunnel.qdrant.config;
19+
20+
public class QdrantSinkOptions extends QdrantBaseOptions {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.seatunnel.connectors.seatunnel.qdrant.config;
19+
20+
public class QdrantSourceOptions extends QdrantBaseOptions {}

seatunnel-connectors-v2/connector-qdrant/src/main/java/org/apache/seatunnel/connectors/seatunnel/qdrant/sink/QdrantSink.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.apache.seatunnel.api.table.catalog.CatalogTable;
2424
import org.apache.seatunnel.api.table.type.SeaTunnelRow;
2525
import org.apache.seatunnel.connectors.seatunnel.common.sink.AbstractSimpleSink;
26-
import org.apache.seatunnel.connectors.seatunnel.qdrant.config.QdrantConfig;
26+
import org.apache.seatunnel.connectors.seatunnel.qdrant.config.QdrantBaseOptions;
2727
import org.apache.seatunnel.connectors.seatunnel.qdrant.config.QdrantParameters;
2828

2929
import java.io.IOException;
@@ -41,7 +41,7 @@ public QdrantSink(ReadonlyConfig config, CatalogTable table) {
4141

4242
@Override
4343
public String getPluginName() {
44-
return QdrantConfig.CONNECTOR_IDENTITY;
44+
return QdrantBaseOptions.CONNECTOR_IDENTITY;
4545
}
4646

4747
@Override

seatunnel-connectors-v2/connector-qdrant/src/main/java/org/apache/seatunnel/connectors/seatunnel/qdrant/sink/QdrantSinkFactory.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
import org.apache.seatunnel.api.table.factory.Factory;
2525
import org.apache.seatunnel.api.table.factory.TableSinkFactory;
2626
import org.apache.seatunnel.api.table.factory.TableSinkFactoryContext;
27-
import org.apache.seatunnel.connectors.seatunnel.qdrant.config.QdrantConfig;
27+
import org.apache.seatunnel.connectors.seatunnel.qdrant.config.QdrantSinkOptions;
2828

2929
import com.google.auto.service.AutoService;
3030

3131
@AutoService(Factory.class)
3232
public class QdrantSinkFactory implements TableSinkFactory {
3333
@Override
3434
public String factoryIdentifier() {
35-
return QdrantConfig.CONNECTOR_IDENTITY;
35+
return QdrantSinkOptions.CONNECTOR_IDENTITY;
3636
}
3737

3838
@Override
@@ -45,10 +45,11 @@ public TableSink createSink(TableSinkFactoryContext context) {
4545
public OptionRule optionRule() {
4646
return OptionRule.builder()
4747
.optional(
48-
QdrantConfig.HOST,
49-
QdrantConfig.PORT,
50-
QdrantConfig.API_KEY,
51-
QdrantConfig.USE_TLS,
48+
QdrantSinkOptions.HOST,
49+
QdrantSinkOptions.PORT,
50+
QdrantSinkOptions.API_KEY,
51+
QdrantSinkOptions.COLLECTION_NAME,
52+
QdrantSinkOptions.USE_TLS,
5253
SinkConnectorCommonOptions.MULTI_TABLE_SINK_REPLICA)
5354
.build();
5455
}

seatunnel-connectors-v2/connector-qdrant/src/main/java/org/apache/seatunnel/connectors/seatunnel/qdrant/source/QdrantSource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import org.apache.seatunnel.connectors.seatunnel.common.source.AbstractSingleSplitReader;
2626
import org.apache.seatunnel.connectors.seatunnel.common.source.AbstractSingleSplitSource;
2727
import org.apache.seatunnel.connectors.seatunnel.common.source.SingleSplitReaderContext;
28-
import org.apache.seatunnel.connectors.seatunnel.qdrant.config.QdrantConfig;
28+
import org.apache.seatunnel.connectors.seatunnel.qdrant.config.QdrantBaseOptions;
2929
import org.apache.seatunnel.connectors.seatunnel.qdrant.config.QdrantParameters;
3030

3131
import java.util.Collections;
@@ -37,7 +37,7 @@ public class QdrantSource extends AbstractSingleSplitSource<SeaTunnelRow> {
3737

3838
@Override
3939
public String getPluginName() {
40-
return QdrantConfig.CONNECTOR_IDENTITY;
40+
return QdrantBaseOptions.CONNECTOR_IDENTITY;
4141
}
4242

4343
public QdrantSource(ReadonlyConfig readonlyConfig) {

seatunnel-connectors-v2/connector-qdrant/src/main/java/org/apache/seatunnel/connectors/seatunnel/qdrant/source/QdrantSourceFactory.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@
1818
package org.apache.seatunnel.connectors.seatunnel.qdrant.source;
1919

2020
import org.apache.seatunnel.api.configuration.util.OptionRule;
21-
import org.apache.seatunnel.api.options.ConnectorCommonOptions;
2221
import org.apache.seatunnel.api.source.SeaTunnelSource;
2322
import org.apache.seatunnel.api.source.SourceSplit;
2423
import org.apache.seatunnel.api.table.connector.TableSource;
2524
import org.apache.seatunnel.api.table.factory.Factory;
2625
import org.apache.seatunnel.api.table.factory.TableSourceFactory;
2726
import org.apache.seatunnel.api.table.factory.TableSourceFactoryContext;
28-
import org.apache.seatunnel.connectors.seatunnel.qdrant.config.QdrantConfig;
27+
import org.apache.seatunnel.connectors.seatunnel.qdrant.config.QdrantSourceOptions;
2928

3029
import com.google.auto.service.AutoService;
3130

@@ -35,7 +34,7 @@
3534
public class QdrantSourceFactory implements TableSourceFactory {
3635
@Override
3736
public String factoryIdentifier() {
38-
return QdrantConfig.CONNECTOR_IDENTITY;
37+
return QdrantSourceOptions.CONNECTOR_IDENTITY;
3938
}
4039

4140
@Override
@@ -47,12 +46,12 @@ TableSource<T, SplitT, StateT> createSource(TableSourceFactoryContext context) {
4746
@Override
4847
public OptionRule optionRule() {
4948
return OptionRule.builder()
50-
.required(QdrantConfig.COLLECTION_NAME, ConnectorCommonOptions.SCHEMA)
49+
.required(QdrantSourceOptions.COLLECTION_NAME, QdrantSourceOptions.SCHEMA)
5150
.optional(
52-
QdrantConfig.HOST,
53-
QdrantConfig.PORT,
54-
QdrantConfig.API_KEY,
55-
QdrantConfig.USE_TLS)
51+
QdrantSourceOptions.HOST,
52+
QdrantSourceOptions.PORT,
53+
QdrantSourceOptions.API_KEY,
54+
QdrantSourceOptions.USE_TLS)
5655
.build();
5756
}
5857

0 commit comments

Comments
 (0)