corgy-w commented on code in PR #7484:
URL: https://github.com/apache/seatunnel/pull/7484#discussion_r1729825471


##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/utils/CatalogUtils.java:
##########
@@ -272,6 +272,16 @@ public static CatalogTable getCatalogTable(
             throws SQLException {
         TableSchema.Builder schemaBuilder = TableSchema.builder();
         Map<String, String> unsupported = new LinkedHashMap<>();
+        String tableName = null;
+        String databaseName = null;
+        String schemaName = null;
+        try {
+            int columnCount = metadata.getColumnCount();
+            tableName = metadata.getTableName(columnCount);
+            databaseName = metadata.getCatalogName(columnCount);
+            schemaName = metadata.getSchemaName(columnCount);

Review Comment:
   
   <img width="619" alt="image" 
src="https://github.com/user-attachments/assets/a548ca73-3515-4c6e-bf07-d665c2004984";>
   
   `getColumnCount` is like a pre-judgement. If it's not exist on the throw 
SQLException.of course, can use `getTableName (1)`, which always gets the first 
element in metadata. 



##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/utils/CatalogUtils.java:
##########
@@ -272,6 +272,16 @@ public static CatalogTable getCatalogTable(
             throws SQLException {
         TableSchema.Builder schemaBuilder = TableSchema.builder();
         Map<String, String> unsupported = new LinkedHashMap<>();
+        String tableName = null;
+        String databaseName = null;
+        String schemaName = null;
+        try {
+            int columnCount = metadata.getColumnCount();
+            tableName = metadata.getTableName(columnCount);
+            databaseName = metadata.getCatalogName(columnCount);
+            schemaName = metadata.getSchemaName(columnCount);

Review Comment:
   
   `getColumnCount` is like a pre-judgement. If it's not exist on the throw 
SQLException.of course, can use `getTableName (1)`, which always gets the first 
element in metadata. 



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