github-actions[bot] commented on code in PR #69528:
URL: https://github.com/apache/doris/pull/69528#discussion_r4366428146
##########
fe/fe-core/src/main/java/org/apache/doris/tablefunction/LocalTableValuedFunction.java:
##########
@@ -135,6 +143,38 @@ private void getFileListFromBackend() throws
AnalysisException {
}
}
+ /** Apply LOCAL admission to sinks that select the built-in local JNI
writer as well. */
+ public static void checkSinkEnabled(String tvfName, Map<String, String>
properties) {
+ String writerClass = properties.getOrDefault("writer_class", "");
+ // JNI consumes a C string, and ScannerLoader accepts slash-separated
class names.
+ int nul = writerClass.indexOf('\0');
+ if (nul >= 0) {
+ writerClass = writerClass.substring(0, nul);
+ }
+ if ("local".equalsIgnoreCase(tvfName)
Review Comment:
[P1] Gate native Hadoop sinks that select local storage
With `enable_local_tvf=false` on a standard Linux BE with Java/Hadoop
support, a global LOAD user can still execute `INSERT INTO
hdfs('file_path'='/tmp/local_gate_', 'format'='csv', 'fs.defaultFS'='file:///',
'fs.file.impl'='org.apache.hadoop.fs.LocalFileSystem') SELECT 1`. Neither
condition here matches, so both sink admission calls permit it. `TVFTableSink`
preserves these Hadoop properties without URI validation; the default native
writer passes `FILE_HDFS` through `FileFactory`, which forwards `file:///` as
the NameNode. The [pinned libhdfs preserves that scheme and calls generic
FileSystem.newInstance](https://github.com/apache/doris-thirdparty/blob/hadoop-3.4.2.2-for-doris/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/hdfs.c#L745),
selecting `LocalFileSystem`; `HdfsFileWriter::create` then opens the generated
`/tmp/local_gate_<query>_0.csv` as the BE OS user without LOCAL admission or
secure-root containment. Thus the new default-off switch leaves nat
ive local writes available. Apply the admission check to the effective Hadoop
filesystem, including local provider overrides, and add disabled-switch
INSERT/EXPLAIN coverage for this route.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]