This is an automated email from the ASF dual-hosted git repository.

danny0405 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new 036bba825df [HUDI-6064] Improve JDBCExecutor#getTableSchema Use 
ColName (#8435)
036bba825df is described below

commit 036bba825dfd0feb74885ec9d40d61a1f29fe589
Author: slfan1989 <[email protected]>
AuthorDate: Mon Apr 17 15:28:34 2023 +0800

    [HUDI-6064] Improve JDBCExecutor#getTableSchema Use ColName (#8435)
    
    Co-authored-by: slfan1989 <louj1988@@>
---
 .../src/main/java/org/apache/hudi/hive/ddl/JDBCExecutor.java       | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/ddl/JDBCExecutor.java
 
b/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/ddl/JDBCExecutor.java
index fdb552dbd17..026bf880835 100644
--- 
a/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/ddl/JDBCExecutor.java
+++ 
b/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/ddl/JDBCExecutor.java
@@ -129,10 +129,11 @@ public class JDBCExecutor extends QueryBasedDDLExecutor {
     ResultSet result = null;
     try {
       DatabaseMetaData databaseMetaData = connection.getMetaData();
-      result = databaseMetaData.getColumns(null, databaseName, tableName, 
null);
+      String catalog = connection.getCatalog();
+      result = databaseMetaData.getColumns(catalog, databaseName, tableName, 
"%");
       while (result.next()) {
-        String columnName = result.getString(4);
-        String columnType = result.getString(6);
+        String columnName = result.getString("COLUMN_NAME");
+        String columnType = result.getString("TYPE_NAME");
         if ("DECIMAL".equals(columnType)) {
           int columnSize = result.getInt("COLUMN_SIZE");
           int decimalDigits = result.getInt("DECIMAL_DIGITS");

Reply via email to