Skip to content

Commit 95b42fa

Browse files
committed
[fix](tvf) Normalize native output path property aliases
1 parent 4a7fa77 commit 95b42fa

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

‎fe/fe-core/src/main/java/org/apache/doris/planner/TVFTableSink.java‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,11 @@ public void bindDataSink() throws AnalysisException {
137137
properties.get("file_path"), backendConnectProps);
138138
backendConnectProps = HadoopTvfAdmission.protectNativeWrite(
139139
properties.get("file_path"), backendConnectProps);
140-
// The path has its own Thrift field and must not partition runtime client caches.
141-
backendConnectProps.remove("file_path");
140+
// Keep output-path aliases, including native NUL projection, out of client configuration.
141+
backendConnectProps.keySet().removeIf(key -> {
142+
int nul = key.indexOf('\0');
143+
return "file_path".equalsIgnoreCase((nul < 0 ? key : key.substring(0, nul)).trim());
144+
});
142145
}
143146

144147
String filePath = properties.get("file_path");

‎fe/fe-core/src/test/java/org/apache/doris/tablefunction/HadoopTvfRuntimeAdmissionTest.java‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import java.util.Collections;
5959
import java.util.HashMap;
6060
import java.util.HashSet;
61+
import java.util.LinkedHashMap;
6162
import java.util.List;
6263
import java.util.Map;
6364
import java.util.Set;
@@ -451,7 +452,12 @@ void brokerWritePrefixesShareOnlyTheSameRuntimeConfiguration() throws Exception
451452
try {
452453
for (int index = 0; index < 3; index++) {
453454
String path = "/data/prefix" + index + "_";
454-
Map<String, String> properties = hdfs("viewfs://prefixes");
455+
Map<String, String> properties = new LinkedHashMap<>();
456+
// SQL preserves spelling and order; the first case-insensitive key survives normalization.
457+
properties.put("FILE_PATH", path);
458+
properties.put("FiLe_PaTh\0suffix", path);
459+
properties.put("FiLe_PaTh \0suffix", path);
460+
properties.putAll(hdfs("viewfs://prefixes"));
455461
properties.put("fs.broker.support", "true");
456462
properties.put("broker.name", "runtime-prefix-test");
457463
properties.put("fs.viewfs.mounttable.prefixes.link./data", "hdfs://nn/base");
@@ -484,8 +490,10 @@ void brokerWritePrefixesShareOnlyTheSameRuntimeConfiguration() throws Exception
484490
() -> Assertions.assertEquals(profiles.get(0), profiles.get(1)),
485491
() -> Assertions.assertNotEquals(profiles.get(0), profiles.get(2)),
486492
() -> Assertions.assertEquals(java.util.Arrays.asList(1, 1, 2), childCounts),
487-
() -> Assertions.assertTrue(sentProperties.stream()
488-
.noneMatch(properties -> properties.containsKey("file_path"))));
493+
() -> Assertions.assertTrue(sentProperties.stream().allMatch(properties ->
494+
!properties.containsKey("file_path") && !properties.containsKey("FILE_PATH")
495+
&& !properties.containsKey("FiLe_PaTh\0suffix")
496+
&& !properties.containsKey("FiLe_PaTh \0suffix"))));
489497
} finally {
490498
for (FileSystem outer : outers) {
491499
outer.close();

0 commit comments

Comments
 (0)