ruanwenjun opened a new issue, #4092:
URL: https://github.com/apache/incubator-seatunnel/issues/4092

   ### Search before asking
   
   - [X] I had searched in the 
[feature](https://github.com/apache/incubator-seatunnel/issues?q=is%3Aissue+label%3A%22Feature%22)
 and found no similar feature requirement.
   
   
   ### Description
   
   We need to have a tool to convert data type between SeaTunnel data type and 
connector data type.
   
   I plan to add new method in Catalog
   ```java
   public interface Catalog {
       /**
        * Return a {@link DataTypeConvertor} used to convert the data type 
between SeaTunnel and the connector.
        */
       DataTypeConvertor<?> getDataTypeConvertor();
   }
   
   public interface DataTypeConvertor<T> {
   
       /**
        * Transfer the data type from connector to SeaTunnel.
        *
        * @param t                  origin data type
        * @param dataTypeProperties origin data type properties, e.g. 
precision, scale, length
        * @return SeaTunnel data type
        */
       // todo: If the origin data type contains the properties, we can remove 
the dataTypeProperties.
       SeaTunnelDataType<?> from(T t, Map<String, Object> dataTypeProperties) 
throws DataTypeConvertException;
   
       /**
        * Transfer the data type from SeaTunnel to connector.
        *
        * @param seaTunnelDataType  seaTunnel data type
        * @param dataTypeProperties seaTunnel data type properties, e.g. 
precision, scale, length
        * @return origin data type
        */
       // todo: If the SeaTunnel data type contains the properties, we can 
remove the dataTypeProperties.
       T to(SeaTunnelDataType<?> seaTunnelDataType, Map<String, Object> 
dataTypeProperties) throws DataTypeConvertException;
   
   }
   ```
   
   ### Usage Scenario
   
   _No response_
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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]

Reply via email to