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

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


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 2334b2a513a [fix](hive) Incorrect location conversion for target path 
for 2.1 (#47162) (#47343)
2334b2a513a is described below

commit 2334b2a513a4b4130e7e3dc05564ba59383cf2cc
Author: wuwenchi <[email protected]>
AuthorDate: Sun Jan 26 23:56:04 2025 +0800

    [fix](hive) Incorrect location conversion for target path for 2.1 (#47162) 
(#47343)
    
    bp: #47162
---
 .../src/main/java/org/apache/doris/common/util/LocationPath.java      | 2 +-
 fe/fe-core/src/main/java/org/apache/doris/planner/HiveTableSink.java  | 4 ++--
 .../src/test/java/org/apache/doris/planner/HiveTableSinkTest.java     | 1 +
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/common/util/LocationPath.java 
b/fe/fe-core/src/main/java/org/apache/doris/common/util/LocationPath.java
index 2318532cba6..4ca8f9605a0 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/util/LocationPath.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/LocationPath.java
@@ -87,7 +87,7 @@ public class LocationPath {
         this(location, props, true);
     }
 
-    private LocationPath(String originLocation, Map<String, String> props, 
boolean convertPath) {
+    public LocationPath(String originLocation, Map<String, String> props, 
boolean convertPath) {
         isBindBroker = props.containsKey(HMSExternalCatalog.BIND_BROKER_NAME);
         String tmpLocation = originLocation;
         if (!(originLocation.contains(SCHEME_DELIM) || 
originLocation.contains(NONSTANDARD_SCHEME_DELIM))) {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/planner/HiveTableSink.java 
b/fe/fe-core/src/main/java/org/apache/doris/planner/HiveTableSink.java
index 653f3dce7d8..65ac2df4ba9 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/HiveTableSink.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/HiveTableSink.java
@@ -122,13 +122,13 @@ public class HiveTableSink extends 
BaseExternalTableDataSink {
         setSerDeProperties(tSink);
 
         THiveLocationParams locationParams = new THiveLocationParams();
-        LocationPath locationPath = new LocationPath(sd.getLocation(), 
targetTable.getHadoopProperties());
+        LocationPath locationPath = new LocationPath(sd.getLocation(), 
targetTable.getHadoopProperties(), false);
         String location = locationPath.getPath().toString();
         String storageLocation = locationPath.toStorageLocation().toString();
         TFileType fileType = locationPath.getTFileTypeForBE();
         if (fileType == TFileType.FILE_S3) {
             locationParams.setWritePath(storageLocation);
-            locationParams.setOriginalWritePath(sd.getLocation());
+            locationParams.setOriginalWritePath(location);
             locationParams.setTargetPath(location);
             if (insertCtx.isPresent()) {
                 HiveInsertCommandContext context = (HiveInsertCommandContext) 
insertCtx.get();
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/planner/HiveTableSinkTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/planner/HiveTableSinkTest.java
index 0efdff4fe85..b57bbcb51a2 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/planner/HiveTableSinkTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/planner/HiveTableSinkTest.java
@@ -95,6 +95,7 @@ public class HiveTableSinkTest {
             hiveTableSink.bindDataSink(Optional.empty());
 
             
Assert.assertEquals(hiveTableSink.tDataSink.hive_table_sink.location.original_write_path,
 location);
+            
Assert.assertEquals(hiveTableSink.tDataSink.hive_table_sink.location.target_path,
 location);
         }
     }
 


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

Reply via email to