Add milvusReader and milvusWriter to support read and write data for milvus#2249
Open
nianliuu wants to merge 2 commits intoalibaba:masterfrom
Open
Add milvusReader and milvusWriter to support read and write data for milvus#2249nianliuu wants to merge 2 commits intoalibaba:masterfrom
nianliuu wants to merge 2 commits intoalibaba:masterfrom
Conversation
d36fe0b to
ef56ae7
Compare
ziming-ai
reviewed
Dec 2, 2024
milvuswriter/src/main/java/com/alibaba/datax/plugin/writer/milvuswriter/MilvusWriter.java
Outdated
Show resolved
Hide resolved
ziming-ai
reviewed
Dec 27, 2024
| @Override | ||
| public void destroy() { | ||
| log.info("Closing Milvus writer, committing data and closing connection"); | ||
| this.milvusBufferWriter.commit(); |
There was a problem hiding this comment.
this.milvusBufferWriter.commit()这个感觉放到startWrite while后,判断下不为空做一次好些。便于理解和维护
| .collectionName(collection) | ||
| .data(dataCache) | ||
| .build(); | ||
| milvusClientV2.upsert(upsertReq); |
| .uri(writerSliceConfig.getString(KeyConstant.URI)) | ||
| .token(writerSliceConfig.getString(KeyConstant.TOKEN)) | ||
| .build(); | ||
| if(writerSliceConfig.getString(KeyConstant.DATABASE) == null) { |
|
|
||
| @Getter | ||
| public enum SchemaCreateMode { | ||
| CREATE_WHEN_NOT_EXIST(0), |
There was a problem hiding this comment.
建议还是用字符串来表示,而不是int,这样任务配置可读性会高很多
● createWhenTableNotExit
● Ignore
● recreate
| } | ||
| UpsertReq upsertReq = UpsertReq.builder() | ||
| .collectionName(collection) | ||
| .data(dataCache) |
There was a problem hiding this comment.
这里看着没有写入对应配置的partition,直接写到了默认partition。 如果配置了partition应该要写到对应partition下
| package com.alibaba.datax.plugin.writer.milvuswriter; | ||
|
|
||
| public class KeyConstant { | ||
| public static final String URI = "uri"; |
There was a problem hiding this comment.
uri改成endpoint吧,datax里基本都用endpoint做参数配置
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Overview
Add MilvusReader and MilvusWriter to support read and write data for milvus
Code Change
Currently, DataX provider no support for vector data, in this PR, we introduced milvusread and writer plugin, which support moving data between milvus
we support the following vector type for now:
Test
tested with data-x example to migrate data from one milvus to another
Limitation