-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature][Connector-V2][Maxcompute] Add Maxcompute source & sink connector #3640
Conversation
# Conflicts: # plugin-mapping.properties # seatunnel-connectors-v2/pom.xml # seatunnel-dist/pom.xml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add e2e tests or picture proof that this connector feature is available.
|
||
## Changelog | ||
|
||
### 2.1.3-beta 2022-12-05 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use next version
will be better.
|
||
## Changelog | ||
|
||
### 2.1.3-beta 2022-12-05 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
public static final Option<String> ACCESS_ID = Options.key("accessId").stringType().noDefaultValue() | ||
.withDescription("Your Maxcompute accessId which cloud be access from Alibaba Cloud"); | ||
public static final Option<String> ACCESS_KEY = Options.key("accesskey").stringType().noDefaultValue() | ||
.withDescription("Your Maxcompute accessKey which cloud be access from Alibaba Cloud"); | ||
public static final Option<String> ENDPOINT = Options.key("endpoint").stringType().noDefaultValue() | ||
.withDescription("Your Maxcompute endpoint start with http"); | ||
public static final Option<String> PROJECT = Options.key("project").stringType().noDefaultValue() | ||
.withDescription("Your Maxcompute project which is created in Alibaba Cloud"); | ||
public static final Option<String> RESULT_TABLE_NAME = Options.key("result_table_name").stringType().noDefaultValue() | ||
.withDescription("Target Maxcompute table name eg: fake"); | ||
public static final Option<String> PARTITION_SPEC = Options.key("partition_spec").stringType().noDefaultValue() | ||
.withDescription("This spec of Maxcompute partition table."); | ||
public static final Option<Integer> SPLIT_ROW = Options.key("split_row").intType().defaultValue(SPLIT_ROW_DEFAULT) | ||
.withDescription("Number of rows per split. default: 10000"); | ||
public static final Option<Boolean> OVERWRITE = Options.key("overwrite").booleanType().defaultValue(false) | ||
.withDescription("Whether to overwrite the table or partition"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix code style.You can refer this pr : e68ecf7
} | ||
|
||
@Override | ||
public OptionRule optionRule() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add UT for optionRule() please.
@Slf4j | ||
public class MaxcomputeWriter extends AbstractSinkWriter<SeaTunnelRow, Void> { | ||
private static final Logger LOG = LoggerFactory.getLogger(MaxcomputeSource.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already using @Slf4j
, LOG may not be useful.
try { | ||
this.session.commit(new Long[]{Thread.currentThread().getId()}); | ||
} catch (TunnelException e) { | ||
throw new RuntimeException(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unify exception for connector.
} | ||
|
||
@Override | ||
public OptionRule optionRule() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add optionRule test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please, give a refer pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refer this:226dc6a
//Doesn't support yet | ||
case MAXCOMPUTE_UNKNOWN: | ||
default: | ||
throw new UnsupportedOperationException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unify exception.
|
||
@Override | ||
public String getPluginName() { | ||
return "MaxcomputeSink"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return "MaxcomputeSink"; | |
return "Maxcompute"; |
|
||
@Override | ||
public String getPluginName() { | ||
return "MaxcomputeSource"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return "MaxcomputeSource"; | |
return "Maxcompute"; |
@Slf4j | ||
public class MaxcomputeSourceReader implements SourceReader<SeaTunnelRow, MaxcomputeSourceSplit> { | ||
private final SourceReader.Context context; | ||
private Set<MaxcomputeSourceSplit> sourceSplits; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private Set<MaxcomputeSourceSplit> sourceSplits; | |
private final Set<MaxcomputeSourceSplit> sourceSplits; |
SeaTunnelDataType<?> seaTunnelDataType = seaTunnelDataTypes[i]; | ||
if (null == rs.get(i)) { | ||
seatunnelField = null; | ||
} else if (BasicType.BOOLEAN_TYPE.equals(seaTunnelDataType)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use switch(seatunnelDataType.getSqlType()) is better. You can refer to https://github.com/apache/incubator-seatunnel/blob/dev/seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/ParquetReadStrategy.java#L128
Overall LGTM except few nits, thank you for your contribution of SeaTunnel. |
| accesskey | string | yes | - | | ||
| endpoint | string | yes | - | | ||
| project | string | yes | - | | ||
| result_table_name | string | yes | - | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
`project` Your Maxcompute project which is created in Alibaba Cloud. | ||
|
||
### result_table_name [string] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this option.
|
||
## Key features | ||
|
||
- [x] [batch](../../concept/connector-v2-features.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| accesskey | string | yes | - | | ||
| endpoint | string | yes | - | | ||
| project | string | yes | - | | ||
| result_table_name | string | yes | - | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete result_table_name
and add common-options
.
@Override | ||
public OptionRule optionRule() { | ||
return OptionRule.builder() | ||
.required(ACCESS_ID, ACCESS_KEY, ENDPOINT, PROJECT, RESULT_TABLE_NAME) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RESULT_TABLE_NAME
is a common options
. It will used by engine to generate logical DAG.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for your contribution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, @TyrantLucifer PTAL
Co-authored-by: hailin0 <hailin088@gmail.com>
Co-authored-by: hailin0 <hailin088@gmail.com>
Purpose of this pull request
Maxcompute source & sink connector #3018
Check list
New License Guide