[improve] Adjust CosFile connector instantiation#9121
[improve] Adjust CosFile connector instantiation#9121misi1987107 wants to merge 8 commits intoapache:devfrom
Conversation
| @Override | ||
| public void setTypeInfo(SeaTunnelRowType seaTunnelRowType) { | ||
| this.seaTunnelRowType = seaTunnelRowType; | ||
| this.fileSinkConfig = new FileSinkConfig(pluginConfig, seaTunnelRowType); | ||
| } |
There was a problem hiding this comment.
Why delete this? We still have some sink should invoke it like OssFileSink, HdfsFileSink etc.
There was a problem hiding this comment.
Sorry,I neet to make adjustments according to purpose2 ,move the connector creation logic from Connector to ConnectorFactory.I don't know how to adjust it
(#8576 (comment))
| @Override | ||
| public List<CatalogTable> getProducedCatalogTables() { | ||
| return SeaTunnelSource.super.getProducedCatalogTables(); | ||
| } |
There was a problem hiding this comment.
We should return catalog table in here to replace getProducedType method.
| (SeaTunnelSource<T, SplitT, StateT>) | ||
| new CosFileSource( | ||
| context.getOptions(), | ||
| CatalogTableUtil.buildWithConfig(context.getOptions())); |
There was a problem hiding this comment.
-1. We should build catalogtable with file sometimes. Please refer https://github.com/apache/seatunnel/pull/9121/files#diff-1f7ebddd2239c9ee909ee66c8f67c119b92f05324519ea5ce40d5aeab98da984L124
|
#8576 (comment) |
|
I used the factory class to create CosFileSource and CosFileLink connectors, but there is a check method testAllConnectorImplementeFactoryWithUpToDateMethod that does not allow deprecated methods, so I skipped the check. |
Please do not do that. The sub reason of #8576 is make sure all method up to date without deprecated method. |
If I don't skip the check method testAllConnectorImplementFactoryWithUpToDateMethod(),I must delete the method BaseFileSink.setTypeInfo(),otherwise, it cannot pass through. |
| // adjusted the connector implementation,not deal with deprecated method yet | ||
| blockList.add("CosFileSourceFactory"); |
There was a problem hiding this comment.
[nitpick] Consider adding a space after the comma for clarity, e.g., 'connector implementation, not dealing with deprecated method yet'.
| // adjusted the connector implementation,not deal with deprecated method yet | |
| blockList.add("CosFileSourceFactory"); | |
| // adjusted the connector implementation, not deal with deprecated method yet |
| @Override | ||
| public <T, SplitT extends SourceSplit, StateT extends Serializable> | ||
| TableSource<T, SplitT, StateT> createSource(TableSourceFactoryContext context) { | ||
| return () -> (SeaTunnelSource<T, SplitT, StateT>) new CosFileSource(context.getOptions()); |
There was a problem hiding this comment.
Consider adding an annotation to suppress the unchecked cast warning or handling the cast more explicitly to ensure type safety.
| return () -> (SeaTunnelSource<T, SplitT, StateT>) new CosFileSource(context.getOptions()); | |
| SeaTunnelSource<?, ?, ?> source = new CosFileSource(context.getOptions()); | |
| if (!(source instanceof SeaTunnelSource<T, SplitT, StateT>)) { | |
| throw new ClassCastException("The created source is not compatible with the expected type."); | |
| } | |
| return () -> (SeaTunnelSource<T, SplitT, StateT>) source; |

Purpose of this pull request
subtask of #8576
Adjust CosFile connector instantiation
Does this PR introduce any user-facing change?
How was this patch tested?
Check list
New License Guide
release-note.