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

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 60272364fe0176a537150d225e967917b12d136f
Author: Tiewei Fang <[email protected]>
AuthorDate: Mon Apr 22 23:39:30 2024 +0800

    [Fix](Jdbc-Hive) fix the order of partition keys (#33963)
    
    The partition key information recorded in PARTITION_KEYS table is sorted 
according to the INTEGER_IDX field, so we need to add an 'order by' clause to 
ensure that the obtained partition names are ordered.
---
 .../apache/doris/datasource/hive/PostgreSQLJdbcHMSCachedClient.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/PostgreSQLJdbcHMSCachedClient.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/PostgreSQLJdbcHMSCachedClient.java
index a98e71d4b2a..a0c2aa29ab5 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/PostgreSQLJdbcHMSCachedClient.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/PostgreSQLJdbcHMSCachedClient.java
@@ -229,7 +229,7 @@ public class PostgreSQLJdbcHMSCachedClient extends 
JdbcHMSCachedClient {
 
     private List<String> getPartitionValues(int partitionId) {
         String sql = String.format("SELECT \"PART_KEY_VAL\" FROM 
\"PARTITION_KEY_VALS\""
-                + " WHERE \"PART_ID\" = " + partitionId);
+                + " WHERE \"PART_ID\" = " + partitionId + " ORDER BY 
\"INTEGER_IDX\"");
         if (LOG.isDebugEnabled()) {
             LOG.debug("getPartitionValues exec sql: {}", sql);
         }
@@ -366,7 +366,7 @@ public class PostgreSQLJdbcHMSCachedClient extends 
JdbcHMSCachedClient {
 
     private List<FieldSchema> getTablePartitionKeys(int tableId) {
         String sql = "SELECT \"PKEY_NAME\", \"PKEY_TYPE\", \"PKEY_COMMENT\" 
from \"PARTITION_KEYS\""
-                + " WHERE \"TBL_ID\"= " + tableId;
+                + " WHERE \"TBL_ID\"= " + tableId + " ORDER BY 
\"INTEGER_IDX\"";
         if (LOG.isDebugEnabled()) {
             LOG.debug("getTablePartitionKeys exec sql: {}", sql);
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to