zhengxiang378928908-code opened a new issue, #11685:
URL: https://github.com/apache/seatunnel/issues/11685

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22)
 and found no similar issues.
   
   ### What happened
   
   `YashanDbTypeConverter` has cases for `CHAR`/`VARCHAR` and 
`NCHAR`/`NVARCHAR`, but not for the Oracle-compatible synonyms `VARCHAR2` and 
`NVARCHAR2`. Reading a YashanDB table that contains such columns falls through 
to the `default` branch and throws:
   
   ```
   ErrorCode:[COMMON-17], ErrorDescription:['YashanDB' unsupported convert type 
'VARCHAR2' of 'test' to SeaTunnel data type.]
   ErrorCode:[COMMON-17], ErrorDescription:['YashanDB' unsupported convert type 
'NVARCHAR2' of 'test' to SeaTunnel data type.]
   ```
   
   This is inconsistent with the connector's own catalog layer: 
`YashanDbCatalog#SELECT_COLUMNS_SQL` already expects both types and even 
encodes which length semantics each one follows.
   
   
https://github.com/apache/seatunnel/blob/dev/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/yashandb/YashanDbCatalog.java#L59-L60
   
   ```sql
   WHEN cols.data_type IN ('VARCHAR', 'VARCHAR2', 'CHAR')  THEN '(' || 
cols.data_length || ')'
   WHEN cols.data_type IN ('NVARCHAR2', 'NCHAR')           THEN '(' || 
cols.char_length || ')'
   ```
   
   So the catalog knows these columns exist and knows `VARCHAR2` follows byte 
length while `NVARCHAR2` follows character length, but the converter rejects 
them.
   
   Since `VARCHAR2` is the primary Oracle string type and YashanDB is 
Oracle-compatible, any table using it currently cannot be read.
   
   ### SeaTunnel Version
   
   dev
   
   ### SeaTunnel Config
   
   ```conf
   Reproduced directly at the converter level, no server required:
   
   YashanDbTypeConverter.INSTANCE.convert(
       BasicTypeDefine.builder()
           
.name("test").columnType("VARCHAR2(100)").dataType("VARCHAR2").length(100L).build());
   ```
   
   ### Running Command
   
   ```shell
   ./mvnw test -pl seatunnel-connectors-v2/connector-jdbc 
-Dtest=YashanDbTypeConverterTest
   ```
   
   ### Error Exception
   
   ```log
   org.apache.seatunnel.common.exception.SeaTunnelRuntimeException: 
ErrorCode:[COMMON-17],
   ErrorDescription:['YashanDB' unsupported convert type 'VARCHAR2' of 'test' 
to SeaTunnel data type.]
   ```
   
   ### Zeta or Flink or Spark Version
   
   Zeta
   
   ### Java or Scala Version
   
   Java 8
   
   ### Screenshots
   
   _No response_
   
   ### Are you willing to submit 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