JNSimba commented on code in PR #355:
URL:
https://github.com/apache/doris-flink-connector/pull/355#discussion_r1545921859
##########
flink-doris-connector/src/main/java/org/apache/doris/flink/tools/cdc/oracle/OracleSchema.java:
##########
@@ -42,4 +46,37 @@ public String convertToDorisType(String fieldType, Integer
precision, Integer sc
public String getCdcTableName() {
return schemaName + "\\." + tableName;
}
+
+ @Override
+ public LinkedHashMap<String, FieldSchema> getColumnInfo(
+ DatabaseMetaData metaData, String databaseName, String schemaName,
String tableName)
+ throws SQLException {
+
+ fields = new LinkedHashMap<>();
+ // Oracle permits table names to include special characters such as /,
+ // etc., as in 'A/B'.
+ // When attempting to fetch column information for `A/B` via JDBC,
+ // it may throw an ORA-01424 error.
+ // Hence, we substitute `/` with '_' to address the issue.
+ try (ResultSet rs =
+ metaData.getColumns(databaseName, schemaName,
tableName.replace("/", "_"), null)) {
+ while (rs.next()) {
+ String fieldName = rs.getString("COLUMN_NAME");
+ String comment = rs.getString("REMARKS");
+ String fieldType = rs.getString("TYPE_NAME");
+ Integer precision = rs.getInt("COLUMN_SIZE");
+
+ if (rs.wasNull()) {
+ precision = null;
+ }
+ Integer scale = rs.getInt("DECIMAL_DIGITS");
+ if (rs.wasNull()) {
+ scale = null;
+ }
+ String dorisTypeStr = convertToDorisType(fieldType, precision,
scale);
+ fields.put(fieldName, new FieldSchema(fieldName, dorisTypeStr,
comment));
Review Comment:
super.getColumnsInfo(meta, databaseName, schemaName, tableName.replace("/",
"_"));
Can we just write it like this?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]