morrySnow commented on code in PR #64853:
URL: https://github.com/apache/doris/pull/64853#discussion_r3542848207


##########
fe/fe-filesystem/fe-filesystem-spi/src/main/java/org/apache/doris/filesystem/spi/FileSystemProvider.java:
##########
@@ -109,6 +111,23 @@ default Set<String> sensitivePropertyKeys() {
         return Collections.emptySet();
     }
 
+    /**
+     * Negotiates the capabilities this provider exposes for the given bound 
configuration.
+     *
+     * <p>Capability is a function of the resolved configuration, not of the 
provider type alone:
+     * the same provider may expose different capabilities depending on the 
config (e.g. Ozone via
+     * the S3 gateway has no {@link FileSystemCapability#ATOMIC_RENAME}, but 
Ozone via {@code ofs://}
+     * does). Defaults to the empty set; providers override to declare what 
they support.
+     *
+     * <p>Capability negotiation is intentionally typed: the caller binds the 
raw property map via
+     * {@link #bind(Map)} first, then negotiates against the resulting 
configuration. There is no
+     * raw-map bridge here — a legacy provider that has not migrated to {@link 
#bind(Map)} cannot be
+     * negotiated against, and a silent fallback would hide that instead of 
surfacing it.
+     */
+    default Set<FileSystemCapability> capabilities(P boundProperties) {

Review Comment:
   **Mutable `EnumSet` returned**: `EnumSet.noneOf(FileSystemCapability.class)` 
creates a mutable set. While each call returns a fresh instance, consider 
wrapping with `Collections.unmodifiableSet()` to make the read-only contract 
explicit. Same suggestion for the `HttpFileSystemProvider.capabilities()` 
override returning `EnumSet.of(READ)` at line 65.



##########
fe/fe-filesystem/fe-filesystem-http/src/main/java/org/apache/doris/filesystem/http/HttpFileSystemProvider.java:
##########
@@ -0,0 +1,73 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.filesystem.http;
+
+import org.apache.doris.filesystem.FileSystem;
+import org.apache.doris.filesystem.properties.FileSystemCapability;
+import org.apache.doris.filesystem.spi.FileSystemProvider;
+
+import java.util.EnumSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * SPI provider for HTTP storage (http://, https://, hf:// URIs).
+ *
+ * <p>HTTP has no FileSystem implementation: the http() TVF reads via 
HttpUtils on FE and
+ * TFileType.FILE_HTTP on BE. This provider only binds and validates 
properties; {@link #create}
+ * throws. Use {@link #capabilities(HttpFileSystemProperties)} (READ) to gate 
operations
+ * instead of calling create().
+ */
+public class HttpFileSystemProvider implements 
FileSystemProvider<HttpFileSystemProperties> {
+
+    @Override
+    public boolean supports(Map<String, String> properties) {
+        if ("HTTP".equalsIgnoreCase(properties.get("_STORAGE_TYPE_"))) {
+            return true;
+        }
+        String uri = properties.getOrDefault("uri", "");
+        return uri.startsWith("http://";) || uri.startsWith("https://";) || 
uri.startsWith("hf://");
+    }
+
+    @Override
+    public HttpFileSystemProperties bind(Map<String, String> properties) {
+        return HttpFileSystemProperties.of(properties);
+    }
+
+    @Override
+    public FileSystem create(HttpFileSystemProperties properties) {

Review Comment:
   **Redundant override**: `FileSystemProvider.create(P properties)` (line 75 
of the SPI) is already a `default` method that throws 
`UnsupportedOperationException`. This override is dead code — the default would 
throw with the same effect. Only the abstract `create(Map<String, String>)` 
override (line 59) is required.



-- 
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]

Reply via email to