This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 7d49851494e [fix](hive) Incorrect location conversion for target path
(#47162)
7d49851494e is described below
commit 7d49851494e82ca89d16bbd6c81d916beb70c0a0
Author: wuwenchi <[email protected]>
AuthorDate: Wed Jan 22 22:32:36 2025 +0800
[fix](hive) Incorrect location conversion for target path (#47162)
### What problem does this PR solve?
Related PR: #46362
Problem Summary:
For the "target_path" field, when the location is of the S3 type, it
should not be converted into the S3 schema.
---
.../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 | 5 +++--
3 files changed, 6 insertions(+), 5 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 3635d10633f..a4012d357e5 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 8794a56eac9..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
@@ -32,8 +32,8 @@ import org.apache.hadoop.hive.metastore.api.Partition;
import org.apache.hadoop.hive.metastore.api.SerDeInfo;
import org.apache.hadoop.hive.metastore.api.StorageDescriptor;
import org.apache.hadoop.hive.metastore.api.Table;
+import org.junit.Assert;
import org.junit.Test;
-import org.locationtech.jts.util.Assert;
import java.util.ArrayList;
import java.util.HashMap;
@@ -94,7 +94,8 @@ public class HiveTableSinkTest {
HiveTableSink hiveTableSink = new HiveTableSink(tbl);
hiveTableSink.bindDataSink(Optional.empty());
-
Assert.equals(hiveTableSink.tDataSink.hive_table_sink.location.original_write_path,
location);
+
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]