Copilot commented on code in PR #9399:
URL: https://github.com/apache/seatunnel/pull/9399#discussion_r2131348908
##########
seatunnel-connectors-v2/connector-tdengine/src/main/java/org/apache/seatunnel/connectors/seatunnel/tdengine/source/TDengineSourceFactory.java:
##########
@@ -43,10 +43,26 @@ public String factoryIdentifier() {
@Override
public OptionRule optionRule() {
return OptionRule.builder()
- .required(URL, USERNAME, PASSWORD, DATABASE, STABLE,
LOWER_BOUND, UPPER_BOUND)
+ .required(
+ TDengineSourceOptions.URL,
+ TDengineSourceOptions.USERNAME,
+ TDengineSourceOptions.PASSWORD,
+ TDengineSourceOptions.DATABASE,
+ TDengineSourceOptions.STABLE,
+ TDengineSourceOptions.LOWER_BOUND,
+ TDengineSourceOptions.UPPER_BOUND)
.build();
}
+ @Override
+ public <T, SplitT extends SourceSplit, StateT extends Serializable>
+ TableSource<T, SplitT, StateT>
createSource(TableSourceFactoryContext context) {
+ CatalogTable catalogTable =
CatalogTableUtil.buildWithConfig(context.getOptions());
+ return () ->
+ (SeaTunnelSource<T, SplitT, StateT>)
+ new TDengineSource(context.getOptions(), catalogTable);
+ }
+
Review Comment:
[nitpick] The lambda expression used in the createSource method is heavily
casted, which may reduce readability. Consider refactoring to introduce
explicit type declarations or a helper method to improve clarity.
```suggestion
return createSeaTunnelSource(context, catalogTable);
}
private <T, SplitT extends SourceSplit, StateT extends Serializable>
TableSource<T, SplitT, StateT> createSeaTunnelSource(
TableSourceFactoryContext context, CatalogTable
catalogTable) {
return () -> {
SeaTunnelSource<T, SplitT, StateT> source =
(SeaTunnelSource<T, SplitT, StateT>) new
TDengineSource(context.getOptions(), catalogTable);
return source;
};
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]