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

suxiaogang223 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 9b38262433f [feat](iceberg) Support Google Authentication for Iceberg 
REST catalog (#62988)
9b38262433f is described below

commit 9b38262433fa616fb7c5dc828fb49f5aab5a3007
Author: Tran Ngoc Tuan <[email protected]>
AuthorDate: Tue Nov 24 09:54:59 2026 +0700

    [feat](iceberg) Support Google Authentication for Iceberg REST catalog 
(#62988)
    
    ### What problem does this PR solve?
    
    Issue Number: close #62987
    
    Currently, Doris's Iceberg REST catalog only supports `none` and
    `oauth2` security types. Users running Google Cloud Lakehouse with
    Iceberg REST catalogs need a way to authenticate using Google's native
    `GoogleAuthManager` via Application Default Credentials (ADC).
    
    ### Solution
    
    This PR adds a new `google` value for `iceberg.rest.security.type` that
    configures the Iceberg REST client to use
    `org.apache.iceberg.gcp.auth.GoogleAuthManager` for authentication,
    following the official [Google Cloud Lakehouse
    
documentation](https://docs.cloud.google.com/lakehouse/docs/lakehouse-iceberg-rest-catalog).
    
    Main changes:
    - `IcebergRestMetaStoreProperties` accepts `google` as a security type,
    and binds two new optional properties: `iceberg.rest.io-impl` and
    `iceberg.rest.google.user-project`.
    - `IcebergCatalogFactory.appendRestGoogleProperties()` sets
    `rest.auth.type` to `GoogleAuthManager`
    (`AuthProperties.AUTH_MANAGER_IMPL_GOOGLE`); `appendRestProperties()`
    forwards `io-impl` and the `header.x-goog-user-project` billing header.
    - New `NativeGcsResolvingFileIO` (`fe-iceberg-common`): a
    `ResolvingFileIO` that keeps `gs://` on `HadoopFileIO`. Bundling
    `iceberg-gcp` would otherwise make upstream `ResolvingFileIO` route
    `gs://` to `GCSFileIO` and ignore the `fs.gs.*` / `fs.s3a.*`
    configuration Doris builds for GCS.
    - Explicit `iceberg-gcp` and `google-cloud-storage` dependencies in the
    FE connector plugin and the BE `iceberg-metadata-scanner` plugin. When
    `io-impl` names `GCSFileIO`, the `$files`, `$entries` and
    `$all_manifests` tasks (and their `all_`/`data_`/`delete_` variants)
    carry it inside `serialized_split`, so the BE has to resolve it too.
    - Tests for the Google auth options, the FileIO choice per catalog
    flavor, and BE-side deserialization of `GCSFileIO` and
    `NativeGcsResolvingFileIO` tasks.
    
    #### Default `io-impl` for GCS-backed catalogs (behavior change)
    
    An explicit `io-impl` / `iceberg.rest.io-impl` is always kept.
    Otherwise:
    
    | GCS credential mode | Catalog flavor | Before | After |
    |---|---|---|---|
    | Native (`DEFAULT` ADC / `COMPUTE_ENGINE`) | all | `ResolvingFileIO` |
    `NativeGcsResolvingFileIO` (same routing: `gs://` on HadoopFileIO,
    `s3`/`s3a` on S3FileIO) |
    | HMAC / anonymous | rest | SDK default `ResolvingFileIO` |
    `NativeGcsResolvingFileIO`, so `gs://` stays on HadoopFileIO now that
    `iceberg-gcp` is bundled |
    | HMAC / anonymous | hms, hadoop, jdbc, glue | SDK default | unchanged
    (HadoopFileIO for hms/hadoop/jdbc, S3FileIO for glue) |
    | none bound, raw `fs.gs.*` keys present | rest | SDK default
    `ResolvingFileIO` | `NativeGcsResolvingFileIO` (as before `iceberg-gcp`
    was bundled: `gs://` on HadoopFileIO with those keys) |
    
    For both rest rows, "Before" is the `io-impl` the REST server sends in
    its `/v1/config` `defaults` when it sends one (e.g. Apache Gravitino),
    and the SDK default `ResolvingFileIO` otherwise. The pinned defaults are
    client properties, so they replace a server default (server `overrides`
    still win). Set `iceberg.rest.io-impl` to keep a specific FileIO.
    
    ### How to use
    
    ```sql
    CREATE CATALOG lakehouse PROPERTIES (
        "type" = "iceberg",
        "iceberg.catalog.type" = "rest",
        "iceberg.rest.uri" = 
"https://biglake.googleapis.com/iceberg/v1/restcatalog";,
        "iceberg.rest.security.type" = "google",
        "iceberg.rest.io-impl" = "org.apache.iceberg.gcp.gcs.GCSFileIO",
        "iceberg.rest.google.user-project" = "my-billing-project",
        "warehouse" = "gs://my-bucket/warehouse/",
        "gs.access_key" = "<GCS HMAC access key>",
        "gs.secret_key" = "<GCS HMAC secret>"
    );
    ```
    
    The two `gs.*` HMAC keys are required for reading data files; see the
    scope note below.
    
    ### Supported scope and limitations
    
    Google authentication covers the FE's connection to the REST catalog and
    the GCS reads the FE performs itself (metadata JSON, manifests it plans
    with). It does not make Doris's BE data path Google-native:
    
    - **Data reads need HMAC keys.** Ordinary Iceberg data files are read by
    the BE's native reader through the GCS S3-interoperability (XML) API,
    which authenticates with HMAC access key/secret only. Doris's GCS
    support is deliberately HMAC-based and does not use the Google JSON API
    (see `GcsFileSystemProperties`). Without
    `gs.access_key`/`gs.secret_key`, REST/manifest access on the FE can
    succeed while any query that reads a data column fails against a private
    bucket. Create the keys in the GCP console under Cloud Storage →
    Settings → Interoperability.
    - **Metadata tables executed on BE need BE-side Google credentials when
    `io-impl=GCSFileIO`.** `$files`, `$entries` and `$all_manifests` tasks
    (and their variants) are deserialized in the BE's
    `iceberg-metadata-scanner` plugin, where `GCSFileIO` builds its own
    client. Provide ADC (or service-account impersonation) on the BE hosts;
    ADC on the FE host alone is not inherited by BE. `$manifests` and
    `$snapshots` are computed on the FE and need nothing extra.
    - **No static GCS token property.** A raw access token cannot refresh
    and would expire after about an hour, so this PR does not add one.
    Refreshable GCS credentials via a REST credentials endpoint are a
    possible follow-up.
    - **Vended credentials do not cover GCS.** A REST catalog's vended
    storage credentials reach the BE through
    `CredentialUtils.filterCloudStorageProperties`, which keeps `gs.*` but
    not `gcs.oauth2.token`, and the BE has no OAuth2 read path.
    - A BE-native Google (OAuth2) read path is out of scope for this PR.
    - **Rolling upgrade (BE first): `$all_manifests` on REST catalogs over
    `gs://` may use BE credentials until the FE is upgraded.** This PR
    bundles `iceberg-gcp` into the BE `iceberg-metadata-scanner`. An FE that
    runs Iceberg 1.12 but not this PR (a build from master after #69031)
    still serializes the SDK default `ResolvingFileIO` for REST catalogs. A
    BE with this PR now resolves `gs://` in such a split to `GCSFileIO` and
    authenticates with the BE host's Application Default Credentials. The
    catalog's HMAC keys, anonymous access, impersonation and custom endpoint
    are not applied, so during the mixed-version window an `$all_manifests`
    query (and its variants) can fail with a GCS 401/403, or succeed under
    the BE host's identity. `$files`, `$entries` and the `all_*` file tables
    are not affected, because the FE resolves `gs://` while planning and
    serializes the resolved `HadoopFileIO` delegate. FEs on an earlier
    Iceberg (branch-4.0/4.1/4.2) fall under the existing rule that Iceberg
    system tables are unavailable while FE and BE run different Doris
    versions. The window closes once the FE is upgraded; to avoid it,
    upgrade the FE promptly after the BE, or avoid `$all_manifests` on such
    catalogs until then. A BE-side compatibility shim was considered and not
    added: `IcebergSerializationCompat` only remaps class descriptors and
    fails closed, and rewriting the FileIO of a deserialized split would
    change its meaning.
    
    ### Security: new outbound requests (SSRF surface)
    
    With `iceberg.rest.security.type=google`, the FE's `GoogleAuthManager`
    requests tokens from Google's OAuth endpoint, and with
    `io-impl=GCSFileIO` the FE (and the BE metadata scanner) open a Google
    Cloud Storage JSON API client. The hosts come from Google defaults, but
    because Iceberg catalog properties are passed through, a user who can
    run CREATE CATALOG or ALTER CATALOG can steer them with raw Iceberg keys
    such as `gcp.auth.credentials-json` (its `token_uri`),
    `gcs.service.host` and `gcs.oauth2.refresh-credentials-endpoint`.
    Reaching these requests therefore requires the privilege to create or
    alter a catalog. The keys are not declared in
    `IcebergConnectorProvider.securitySurface()` in this PR; whether to add
    them via `ConnectorSecuritySurface.ofSsrfEndpoints(...)` is open for
    maintainers to decide.
    
    ### Release note
    
    **Features**
    - [Iceberg] Support Google Authentication (GoogleAuthManager) for
    Iceberg REST catalog
    
    **Limitations**
    - The new `google` security type authenticates the FE's REST and
    metadata access through Application Default Credentials. Reading data
    files from a private GCS bucket still requires GCS HMAC keys
    (`gs.access_key` / `gs.secret_key`). With `io-impl=GCSFileIO`, metadata
    tables executed on BE (`$files`, `$entries`, `$all_manifests`) require
    ADC on the BE hosts.
    - During a BE-first rolling upgrade from an FE build on Iceberg 1.12
    without this change, `$all_manifests` on REST catalogs over `gs://` may
    read through `GCSFileIO` with the BE host's Application Default
    Credentials instead of the catalog's GCS settings, until the FE is
    upgraded.
    
    ---------
    
    Co-authored-by: Claude Opus 4.7 <[email protected]>
    Co-authored-by: Tran Ngoc Tuan <[email protected]>
---
 .../iceberg-metadata-scanner/pom.xml               |  28 +++
 .../apache/doris/iceberg/IcebergPluginTest.java    |  95 +++++++--
 .../iceberg/IcebergSerializationCompatTest.java    |  28 +++
 fe/check/checkstyle/suppressions.xml               |   2 +
 fe/fe-connector/fe-connector-iceberg/pom.xml       |  14 ++
 .../connector/iceberg/IcebergCatalogFactory.java   |  43 +++-
 .../doris/connector/iceberg/IcebergConnector.java  |   4 +-
 .../iceberg/IcebergCatalogFactoryTest.java         | 224 ++++++++++++++++++++-
 .../IcebergConnectorValidatePropertiesTest.java    |   2 +-
 .../rest/IcebergRestMetaStoreProperties.java       |  25 ++-
 .../rest/IcebergRestMetaStorePropertiesTest.java   |  23 ++-
 fe/fe-iceberg-common/pom.xml                       |  13 ++
 .../iceberg/io/NativeGcsResolvingFileIO.java       |  47 +++++
 fe/pom.xml                                         |   3 +
 14 files changed, 524 insertions(+), 27 deletions(-)

diff --git a/fe/be-java-extensions/iceberg-metadata-scanner/pom.xml 
b/fe/be-java-extensions/iceberg-metadata-scanner/pom.xml
index 7e27fab2c35..f956d9d2fa0 100644
--- a/fe/be-java-extensions/iceberg-metadata-scanner/pom.xml
+++ b/fe/be-java-extensions/iceberg-metadata-scanner/pom.xml
@@ -79,6 +79,34 @@ under the License.
             <artifactId>iceberg-aws</artifactId>
             <version>${iceberg.version}</version>
         </dependency>
+        <!--
+          The GCS twin of the FileIO above: 
org.apache.iceberg.gcp.gcs.GCSFileIO is named by string
+          in the catalog property io-impl and, when io-impl names it, rides 
inside every serialized
+          $files, $entries and $all_manifests task, with their 
all_/data_/delete_ variants
+          (BaseFilesTable.ManifestReadTask keeps table.io(); $manifests is a 
StaticDataTask and
+          carries no FileIO). Without this artifact the BE side of a
+          GCS-backed system-table scan dies in IcebergSerializationCompat, 
which reports the
+          ClassNotFoundException as an Iceberg version mismatch and hides the 
cause.
+        -->
+        <dependency>
+            <groupId>org.apache.iceberg</groupId>
+            <artifactId>iceberg-gcp</artifactId>
+            <version>${iceberg.version}</version>
+            <scope>runtime</scope>
+        </dependency>
+        <!--
+          Same hole as the AWS SDK block below: iceberg-gcp names no Google 
SDK dependency of its
+          own (google-cloud-storage is compileOnly upstream, and its pom does 
not list it at all),
+          while GCSFileIO lazily builds a Storage client out of the properties 
carried by the
+          deserialized task. The version is google-cloud-storage.version in 
fe/pom.xml, shared with
+          the FE connector plugin, so both sides of one catalog run the same 
client.
+        -->
+        <dependency>
+            <groupId>com.google.cloud</groupId>
+            <artifactId>google-cloud-storage</artifactId>
+            <version>${google-cloud-storage.version}</version>
+            <scope>runtime</scope>
+        </dependency>
         <!--
           iceberg-aws declares no AWS SDK dependency of its own (they are 
compileOnly upstream), so
           every client a deserialized FileIO reaches has to be named here.
diff --git 
a/fe/be-java-extensions/iceberg-metadata-scanner/src/test/java/org/apache/doris/iceberg/IcebergPluginTest.java
 
b/fe/be-java-extensions/iceberg-metadata-scanner/src/test/java/org/apache/doris/iceberg/IcebergPluginTest.java
index 7965c280b42..23ca53bc9a3 100644
--- 
a/fe/be-java-extensions/iceberg-metadata-scanner/src/test/java/org/apache/doris/iceberg/IcebergPluginTest.java
+++ 
b/fe/be-java-extensions/iceberg-metadata-scanner/src/test/java/org/apache/doris/iceberg/IcebergPluginTest.java
@@ -24,6 +24,7 @@ import org.apache.doris.jni.spi.utils.OffHeap;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
+import org.apache.iceberg.CatalogProperties;
 import org.apache.iceberg.DataFiles;
 import org.apache.iceberg.FileScanTask;
 import org.apache.iceberg.MetadataTableType;
@@ -34,8 +35,12 @@ import org.apache.iceberg.Table;
 import org.apache.iceberg.TableScan;
 import org.apache.iceberg.aws.s3.S3FileIO;
 import org.apache.iceberg.aws.s3.S3FileIOProperties;
+import org.apache.iceberg.catalog.TableIdentifier;
+import org.apache.iceberg.hadoop.HadoopCatalog;
+import org.apache.iceberg.hadoop.HadoopFileIO;
 import org.apache.iceberg.hadoop.HadoopTables;
 import org.apache.iceberg.io.CloseableIterable;
+import org.apache.iceberg.io.NativeGcsResolvingFileIO;
 import org.apache.iceberg.types.Types;
 import org.apache.iceberg.util.SerializationUtil;
 import org.junit.jupiter.api.Assertions;
@@ -113,6 +118,28 @@ public class IcebergPluginTest {
         }
     }
 
+    /**
+     * WHY: this plugin bundles iceberg-gcp, so an upstream ResolvingFileIO 
deserialized here would route gs:// to
+     * GCSFileIO and ignore the fs.gs.* / fs.s3a.* configuration Doris builds 
for GCS and the FE bound into the
+     * task's Hadoop configuration. MUTATION: dropping the implFromLocation 
override -> GCSFileIO -> red. (The FE
+     * default io-impl is guarded by IcebergCatalogFactoryTest, not here.)
+     */
+    @Test
+    public void keepsGcsOnHadoopFileIoAfterSerialization() throws Exception {
+        Configuration conf = new Configuration();
+        conf.set("fs.gs.auth.type", "COMPUTE_ENGINE");
+        try (NativeGcsResolvingFileIO original = new 
NativeGcsResolvingFileIO()) {
+            original.setConf(conf);
+            original.initialize(new HashMap<>());
+            String wire = SerializationUtil.serializeToBase64(original);
+            try (NativeGcsResolvingFileIO restored = 
IcebergSerializationCompat.deserializeFromBase64(wire)) {
+                Assertions.assertEquals(HadoopFileIO.class, 
restored.ioClass("gs://bucket/manifest.avro"));
+                Assertions.assertEquals(S3FileIO.class, 
restored.ioClass("s3://bucket/manifest.avro"));
+                Assertions.assertEquals("COMPUTE_ENGINE", 
restored.getConf().get("fs.gs.auth.type"));
+            }
+        }
+    }
+
     @Test
     public void instantiatesNativeGcsFilesystem() throws Exception {
         Configuration conf = new Configuration();
@@ -219,18 +246,62 @@ public class IcebergPluginTest {
      */
     @Test
     public void scansAMetadataTableFromASerializedTask(@TempDir Path 
warehouse) throws IOException {
-        String serializedTask = planOneSnapshotsTask(warehouse);
+        assertScansOneTask(warehouse, MetadataTableType.SNAPSHOTS, 
"snapshot_id");
+    }
+
+    /**
+     * The {@code $files} family is the shape that carries a FileIO across: 
BaseFilesTable.ManifestReadTask
+     * keeps {@code table.io()} and reads the manifest through it on this 
side, so unlike a StaticDataTask it
+     * resolves the FileIO class the catalog was configured with. A REST 
catalog that names
+     * {@code io-impl=GCSFileIO} ships that class, whose closure is asserted 
by IcebergSerializationCompatTest;
+     * the FileIO here is hadoop's, because a real GCS table needs credentials 
no unit test has.
+     */
+    @Test
+    public void scansAFilesMetadataTableFromASerializedTask(@TempDir Path 
warehouse) throws IOException {
+        assertScansOneTask(warehouse, MetadataTableType.FILES, "record_count");
+    }
 
+    /**
+     * WHY: every GCS-bound catalog whose FE default FileIO is pinned ships 
{@code NativeGcsResolvingFileIO} inside
+     * its {@code $files} tasks, so this plugin must deserialize that class 
and read the manifest through it.
+     * MUTATION: dropping NativeGcsResolvingFileIO (fe-iceberg-common) from 
the plugin -> ClassNotFoundException
+     * -> red.
+     */
+    @Test
+    public void 
scansAFilesMetadataTableThroughNativeGcsResolvingFileIo(@TempDir Path 
warehouse) throws IOException {
+        Map<String, String> properties = new HashMap<>();
+        properties.put(CatalogProperties.WAREHOUSE_LOCATION, 
warehouse.toUri().toString());
+        properties.put(CatalogProperties.FILE_IO_IMPL, 
NativeGcsResolvingFileIO.class.getName());
+        HadoopCatalog catalog = new HadoopCatalog();
+        catalog.setConf(new Configuration());
+        catalog.initialize("native_gcs", properties);
+        Schema schema = new Schema(Types.NestedField.required(1, "id", 
Types.IntegerType.get()));
+        Table table = catalog.createTable(TableIdentifier.of("db", "t"), 
schema, PartitionSpec.unpartitioned());
+        Assertions.assertInstanceOf(NativeGcsResolvingFileIO.class, 
table.io());
+        assertScansOneTask(planOneMetadataTask(table, warehouse, 
MetadataTableType.FILES, "record_count"),
+                MetadataTableType.FILES, "record_count");
+    }
+
+    private static void assertScansOneTask(Path warehouse, MetadataTableType 
type, String projectedColumn)
+            throws IOException {
+        Schema schema = new Schema(Types.NestedField.required(1, "id", 
Types.IntegerType.get()));
+        Table table = new HadoopTables(new Configuration())
+                .create(schema, PartitionSpec.unpartitioned(), 
warehouse.resolve("t").toString());
+        assertScansOneTask(planOneMetadataTask(table, warehouse, type, 
projectedColumn), type, projectedColumn);
+    }
+
+    private static void assertScansOneTask(String serializedSplit, 
MetadataTableType type, String projectedColumn)
+            throws IOException {
         Map<String, String> params = new HashMap<>();
-        params.put("serialized_split", serializedTask);
-        params.put("required_fields", "snapshot_id");
+        params.put("serialized_split", serializedSplit);
+        params.put("required_fields", projectedColumn);
         params.put("required_types", "bigint");
         params.put("time_zone", "UTC");
 
         JniScanner scanner = 
loadPlugin().getScannerFactories().iterator().next().create(16, params);
         scanner.open();
         try {
-            Assertions.assertNotEquals(0, scanner.getNextBatchMeta(), "the one 
snapshot row");
+            Assertions.assertNotEquals(0, scanner.getNextBatchMeta(), "the one 
" + type + " row");
             Assertions.assertEquals(1, scanner.getTable().getNumRows());
             scanner.releaseTable();
             Assertions.assertEquals(0, scanner.getNextBatchMeta(), "0 means 
end of stream");
@@ -240,14 +311,12 @@ public class IcebergPluginTest {
     }
 
     /**
-     * Builds a table with one snapshot and plans its {@code $snapshots} 
metadata table the way
+     * Appends one file to {@code table} and plans one row of its {@code type} 
metadata table the way
      * IcebergScanPlanProvider.doPlanSystemTableScan does, down to projecting 
the scan to exactly the
      * requested column - the projection the scanner's positional row reads 
depend on.
      */
-    private static String planOneSnapshotsTask(Path warehouse) throws 
IOException {
-        Schema schema = new Schema(Types.NestedField.required(1, "id", 
Types.IntegerType.get()));
-        Table table = new HadoopTables(new Configuration())
-                .create(schema, PartitionSpec.unpartitioned(), 
warehouse.resolve("t").toString());
+    private static String planOneMetadataTask(Table table, Path warehouse, 
MetadataTableType type,
+            String projectedColumn) throws IOException {
         table.newAppend()
                 .appendFile(DataFiles.builder(PartitionSpec.unpartitioned())
                         
.withPath(warehouse.resolve("t/data/f.parquet").toString())
@@ -256,13 +325,13 @@ public class IcebergPluginTest {
                         .build())
                 .commit();
 
-        Table snapshots = 
MetadataTableUtils.createMetadataTableInstance(table, 
MetadataTableType.SNAPSHOTS);
-        TableScan scan = snapshots.newScan()
-                .project(new 
Schema(snapshots.schema().findField("snapshot_id")));
+        Table metadata = MetadataTableUtils.createMetadataTableInstance(table, 
type);
+        TableScan scan = metadata.newScan()
+                .project(new 
Schema(metadata.schema().findField(projectedColumn)));
         try (CloseableIterable<FileScanTask> tasks = scan.planFiles()) {
             List<FileScanTask> planned = new ArrayList<>();
             tasks.forEach(planned::add);
-            Assertions.assertEquals(1, planned.size(), "one snapshot, one 
task");
+            Assertions.assertEquals(1, planned.size(), "one " + type + " row, 
one task");
             return SerializationUtil.serializeToBase64(planned.get(0));
         }
     }
diff --git 
a/fe/be-java-extensions/iceberg-metadata-scanner/src/test/java/org/apache/doris/iceberg/IcebergSerializationCompatTest.java
 
b/fe/be-java-extensions/iceberg-metadata-scanner/src/test/java/org/apache/doris/iceberg/IcebergSerializationCompatTest.java
index 3d28b18146f..38e82965535 100644
--- 
a/fe/be-java-extensions/iceberg-metadata-scanner/src/test/java/org/apache/doris/iceberg/IcebergSerializationCompatTest.java
+++ 
b/fe/be-java-extensions/iceberg-metadata-scanner/src/test/java/org/apache/doris/iceberg/IcebergSerializationCompatTest.java
@@ -17,11 +17,13 @@
 
 package org.apache.doris.iceberg;
 
+import com.google.cloud.storage.Storage;
 import org.apache.iceberg.DataFiles;
 import org.apache.iceberg.FileFormat;
 import org.apache.iceberg.FileScanTask;
 import org.apache.iceberg.PartitionSpec;
 import org.apache.iceberg.Schema;
+import org.apache.iceberg.gcp.gcs.GCSFileIO;
 import org.apache.iceberg.types.Types;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
@@ -35,6 +37,8 @@ import java.io.Serializable;
 import java.nio.ByteBuffer;
 import java.nio.charset.StandardCharsets;
 import java.util.Base64;
+import java.util.HashMap;
+import java.util.Map;
 
 public class IcebergSerializationCompatTest {
     // BaseFile's serialVersionUID in Iceberg 1.11.0; 1.12.0 changed it (and 
added a field).
@@ -107,6 +111,30 @@ public class IcebergSerializationCompatTest {
         Assertions.assertInstanceOf(ClassNotFoundException.class, 
e.getCause());
     }
 
+    @Test
+    public void deserializesTheGcsFileIoATaskCarries() throws Exception {
+        // WHY: a REST catalog configured with 
io-impl=org.apache.iceberg.gcp.gcs.GCSFileIO serializes that FileIO
+        // into its $files, $entries and $all_manifests tasks, with their 
all_/data_/delete_ variants
+        // (BaseFilesTable.ManifestReadTask keeps table.io(); $manifests is a 
StaticDataTask), so the BE plugin
+        // has to carry iceberg-gcp plus the google-cloud-storage client 
GCSFileIO builds from the task's
+        // properties. MUTATION: dropping either dependency from the plugin 
pom -> ClassNotFoundException (mapped
+        // to the "different Iceberg version" message) or NoClassDefFoundError 
on client() -> red.
+        Map<String, String> properties = new HashMap<>();
+        properties.put("gcs.project-id", "gcs-fileio-test");
+        // NoCredentials: the client is built here only to prove the Google 
SDK closure links, so the build must not
+        // depend on whatever Application Default Credentials the machine 
running this test happens to have.
+        properties.put("gcs.no-auth", "true");
+        GCSFileIO fileIo = new GCSFileIO();
+        fileIo.initialize(properties);
+
+        GCSFileIO deserialized = 
IcebergSerializationCompat.deserializeFromBase64(serializeToBase64(fileIo));
+
+        Assertions.assertEquals("gcs-fileio-test", 
deserialized.properties().get("gcs.project-id"));
+        try (Storage client = deserialized.client()) {
+            Assertions.assertNotNull(client);
+        }
+    }
+
     private static final class Probe implements Serializable {
         private static final long serialVersionUID = 1L;
     }
diff --git a/fe/check/checkstyle/suppressions.xml 
b/fe/check/checkstyle/suppressions.xml
index 708822add48..0594a35eb86 100644
--- a/fe/check/checkstyle/suppressions.xml
+++ b/fe/check/checkstyle/suppressions.xml
@@ -87,6 +87,8 @@ under the License.
     <suppress 
files="org[\\/]apache[\\/]iceberg[\\/]ManifestReaderAccess\.java" 
checks="ImportControl"/>
     <!-- Iceberg package access is required to build a StaticDataTask for REST 
catalog labels; other checks apply. -->
     <suppress 
files="org[\\/]apache[\\/]iceberg[\\/]IcebergLabelsDataTask\.java" 
checks="ImportControl"/>
+    <!-- Iceberg package access is required to override 
ResolvingFileIO.implFromLocation; other checks apply. -->
+    <suppress 
files="org[\\/]apache[\\/]iceberg[\\/]io[\\/]NativeGcsResolvingFileIO\.java" 
checks="ImportControl"/>
 
     <!-- ignore gensrc/thrift/ExternalTableSchema.thrift -->
     <suppress files=".*thrift/schema/external/.*" checks=".*"/>
diff --git a/fe/fe-connector/fe-connector-iceberg/pom.xml 
b/fe/fe-connector/fe-connector-iceberg/pom.xml
index d17f5c467e0..fe3d376f126 100644
--- a/fe/fe-connector/fe-connector-iceberg/pom.xml
+++ b/fe/fe-connector/fe-connector-iceberg/pom.xml
@@ -129,6 +129,20 @@ under the License.
             <version>${iceberg.version}</version>
         </dependency>
 
+        <!-- GoogleAuthManager and GCSFileIO are loaded by name inside the 
connector plugin. -->
+        <dependency>
+            <groupId>org.apache.iceberg</groupId>
+            <artifactId>iceberg-gcp</artifactId>
+            <version>${iceberg.version}</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.google.cloud</groupId>
+            <artifactId>google-cloud-storage</artifactId>
+            <version>${google-cloud-storage.version}</version>
+            <scope>runtime</scope>
+        </dependency>
+
         <!-- Caffeine: needed on the COMPILE classpath for the vendored 
split-package
              org.apache.iceberg.DeleteFileIndex (T08). iceberg-core 1.10.1 
made DeleteFileIndex package-private,
              so the connector ships its own public copy (mirrors fe-core) to 
drive manifest-level scan planning;
diff --git 
a/fe/fe-connector/fe-connector-iceberg/src/main/java/org/apache/doris/connector/iceberg/IcebergCatalogFactory.java
 
b/fe/fe-connector/fe-connector-iceberg/src/main/java/org/apache/doris/connector/iceberg/IcebergCatalogFactory.java
index 4f75779e494..61fdc15f774 100644
--- 
a/fe/fe-connector/fe-connector-iceberg/src/main/java/org/apache/doris/connector/iceberg/IcebergCatalogFactory.java
+++ 
b/fe/fe-connector/fe-connector-iceberg/src/main/java/org/apache/doris/connector/iceberg/IcebergCatalogFactory.java
@@ -39,6 +39,8 @@ import org.apache.iceberg.aws.AwsClientProperties;
 import org.apache.iceberg.aws.AwsProperties;
 import org.apache.iceberg.aws.HttpClientProperties;
 import org.apache.iceberg.aws.s3.S3FileIOProperties;
+import org.apache.iceberg.io.NativeGcsResolvingFileIO;
+import org.apache.iceberg.rest.auth.AuthProperties;
 import org.apache.iceberg.rest.auth.OAuth2Properties;
 
 import java.io.File;
@@ -113,6 +115,8 @@ public final class IcebergCatalogFactory {
     private static final String REST_SIGV4_ENABLED_KEY = "rest.sigv4-enabled";
     private static final String REST_SIGNING_REGION_KEY = 
"rest.signing-region";
     private static final String SECURITY_TYPE_OAUTH2 = "oauth2";
+    private static final String SECURITY_TYPE_GOOGLE = "google";
+    private static final String REST_GOOGLE_USER_PROJECT_HEADER = 
"header.x-goog-user-project";
 
     // GLUE.
     private static final String GLUE_CREDENTIALS_PROVIDER_KEY = 
"client.credentials-provider";
@@ -455,6 +459,18 @@ public final class IcebergCatalogFactory {
         }
         chosenS3.ifPresent(storage -> 
storage.toBackendProperties().ifPresent(backend -> {
             Optional<GcsAuth> auth = GcsAuthResolver.resolve(backend.toMap());
+            // Keep explicit FileIO choices. The plugin bundles iceberg-gcp, 
so upstream ResolvingFileIO
+            // routes gs to GCSFileIO whenever that class is loadable - 
independently of which GCS
+            // credential mode is configured - and drops the fs.gs.* / 
fs.s3a.* configuration Doris
+            // builds for GCS. Native ADC / COMPUTE_ENGINE bindings always get 
the pin (they emit the
+            // S3FileIO dialect below). HMAC and anonymous bindings get it 
only on REST, the one flavor
+            // whose SDK default is ResolvingFileIO; hms / hadoop / jdbc 
default to HadoopFileIO and glue
+            // to S3FileIO, and HMS emits no S3FileIO options, so the pin 
would send its s3/s3a paths to
+            // an unconfigured S3FileIO.
+            auth.filter(gcsAuth -> gcsAuth.getNativeCredential().isPresent()
+                            || 
IcebergCatalogProperties.TYPE_REST.equals(flavor))
+                    .ifPresent(ignored -> 
opts.putIfAbsent(CatalogProperties.FILE_IO_IMPL,
+                            NativeGcsResolvingFileIO.class.getName()));
             if (auth.filter(GcsAuth::isAnonymous).isPresent()) {
                 // Glue and REST metadata can require AWS authentication even 
when GCS objects are public.
                 opts.put(S3FileIOProperties.CLIENT_FACTORY, 
AnonymousS3FileIOAwsClientFactory.class.getName());
@@ -480,18 +496,27 @@ public final class IcebergCatalogFactory {
                 opts.put(GcpCredential.CREDENTIAL_PROVIDER_TYPE, 
credential.getCredentialProviderType().name());
                 putIfNotBlank(opts, 
GcpCredential.IMPERSONATION_SERVICE_ACCOUNT,
                         credential.getImpersonationServiceAccount());
-                // Keep explicit FileIO choices. By default, S3 aliases use 
the GCP client factory,
-                // while gs/HDFS paths use HadoopFileIO with the native 
fs.gs.* configuration
-                // (the plugin does not bundle iceberg-gcp's GCSFileIO).
-                opts.putIfAbsent(CatalogProperties.FILE_IO_IMPL, 
"org.apache.iceberg.io.ResolvingFileIO");
+                // S3 aliases use the GCP client factory; gs/HDFS stay on 
HadoopFileIO (pinned above)
+                // with the native fs.gs.* configuration emitted here.
                 opts.put(S3FileIOProperties.CLIENT_FACTORY, 
GcpS3FileIOAwsClientFactory.class.getName());
             });
         }));
+        if (IcebergCatalogProperties.TYPE_REST.equals(flavor) && 
hasRawGcsHadoopProperties(props)) {
+            // A REST catalog configured only through raw fs.gs.* keys (opaque 
warehouse, no typed GCS binding)
+            // binds no storage above. Before iceberg-gcp was bundled, 
ResolvingFileIO could not load GCSFileIO
+            // and fell back to HadoopFileIO, which honors those keys 
(buildHadoopConfiguration). Keep that
+            // routing so gs:// does not silently switch to GCSFileIO with 
ADC. Explicit FileIO choices win.
+            opts.putIfAbsent(CatalogProperties.FILE_IO_IMPL, 
NativeGcsResolvingFileIO.class.getName());
+        }
         // The iceberg SDK forbids both "type" and "catalog-impl"; legacy 
buildIcebergCatalog removes "type".
         opts.remove(CatalogUtil.ICEBERG_CATALOG_TYPE);
         return opts;
     }
 
+    private static boolean hasRawGcsHadoopProperties(Map<String, String> 
props) {
+        return props.keySet().stream().anyMatch(key -> 
key.startsWith("fs.gs."));
+    }
+
     /**
      * Assembles the iceberg catalog OPTIONS map for the BESPOKE {@code 
s3tables} flavor, mirroring the legacy
      * fe-core {@code AbstractIcebergProperties.initializeCatalog} base + 
{@code IcebergS3TablesMetaStoreProperties}
@@ -570,10 +595,20 @@ public final class IcebergCatalogFactory {
         // Timeouts: legacy fields default non-blank, so they are effectively 
always emitted.
         opts.put(REST_CONNECTION_TIMEOUT_MS_KEY, 
rest.getConnectionTimeoutMs());
         opts.put(REST_SOCKET_TIMEOUT_MS_KEY, rest.getSocketTimeoutMs());
+        putIfNotBlank(opts, CatalogProperties.FILE_IO_IMPL, rest.getIoImpl());
+        putIfNotBlank(opts, REST_GOOGLE_USER_PROJECT_HEADER, 
rest.getGoogleUserProject());
         appendRestOAuth2Properties(opts, rest);
+        appendRestGoogleProperties(opts, rest);
         appendRestSigningProperties(opts, rest, props, chosenS3);
     }
 
+    private static void appendRestGoogleProperties(Map<String, String> opts, 
IcebergRestMetaStoreProperties rest) {
+        if (!SECURITY_TYPE_GOOGLE.equalsIgnoreCase(rest.getSecurityType())) {
+            return;
+        }
+        opts.put(AuthProperties.AUTH_TYPE, 
AuthProperties.AUTH_MANAGER_IMPL_GOOGLE);
+    }
+
     private static void appendRestOAuth2Properties(Map<String, String> opts, 
IcebergRestMetaStoreProperties rest) {
         if (!SECURITY_TYPE_OAUTH2.equalsIgnoreCase(rest.getSecurityType())) {
             return;
diff --git 
a/fe/fe-connector/fe-connector-iceberg/src/main/java/org/apache/doris/connector/iceberg/IcebergConnector.java
 
b/fe/fe-connector/fe-connector-iceberg/src/main/java/org/apache/doris/connector/iceberg/IcebergConnector.java
index 8b1074e1fd7..fea53ee0074 100644
--- 
a/fe/fe-connector/fe-connector-iceberg/src/main/java/org/apache/doris/connector/iceberg/IcebergConnector.java
+++ 
b/fe/fe-connector/fe-connector-iceberg/src/main/java/org/apache/doris/connector/iceberg/IcebergConnector.java
@@ -1083,8 +1083,8 @@ public class IcebergConnector implements Connector {
                 break;
             default:
                 // rest / hadoop / glue: FileIO needs the bound storage 
configuration, including
-                // native GCS credentials when ResolvingFileIO falls back to 
HadoopFileIO, plus raw
-                // fs./dfs./hadoop. passthrough.
+                // native GCS credentials for the gs:// paths 
NativeGcsResolvingFileIO keeps on
+                // HadoopFileIO, plus raw fs./dfs./hadoop. passthrough.
                 conf = 
IcebergCatalogFactory.buildHadoopConfiguration(properties, storageHadoopConfig);
                 break;
         }
diff --git 
a/fe/fe-connector/fe-connector-iceberg/src/test/java/org/apache/doris/connector/iceberg/IcebergCatalogFactoryTest.java
 
b/fe/fe-connector/fe-connector-iceberg/src/test/java/org/apache/doris/connector/iceberg/IcebergCatalogFactoryTest.java
index 4fae7f3286e..f6265a934b0 100644
--- 
a/fe/fe-connector/fe-connector-iceberg/src/test/java/org/apache/doris/connector/iceberg/IcebergCatalogFactoryTest.java
+++ 
b/fe/fe-connector/fe-connector-iceberg/src/test/java/org/apache/doris/connector/iceberg/IcebergCatalogFactoryTest.java
@@ -39,6 +39,7 @@ import org.apache.iceberg.hadoop.HadoopFileIO;
 import org.apache.iceberg.hadoop.HadoopInputFile;
 import org.apache.iceberg.io.FileIO;
 import org.apache.iceberg.io.InputFile;
+import org.apache.iceberg.io.NativeGcsResolvingFileIO;
 import org.apache.iceberg.io.SeekableInputStream;
 import org.apache.iceberg.rest.responses.ConfigResponse;
 import org.junit.jupiter.api.Assertions;
@@ -519,6 +520,70 @@ public class IcebergCatalogFactoryTest {
         Assertions.assertNull(opts.get("credential"));
     }
 
+    @Test
+    public void appendRestGoogleSecurityType() {
+        Map<String, String> opts = new HashMap<>();
+        appendRest(opts, props("iceberg.rest.security.type", "google"), 
Optional.empty());
+        
Assertions.assertEquals("org.apache.iceberg.gcp.auth.GoogleAuthManager", 
opts.get("rest.auth.type"));
+        Assertions.assertFalse(opts.containsKey("credential"));
+        Assertions.assertFalse(opts.containsKey("token"));
+    }
+
+    @Test
+    public void appendRestGoogleWithIoImpl() {
+        Map<String, String> opts = new HashMap<>();
+        appendRest(opts, props("iceberg.rest.security.type", "google",
+                "iceberg.rest.io-impl", 
"org.apache.iceberg.gcp.gcs.GCSFileIO"), Optional.empty());
+        Assertions.assertEquals("org.apache.iceberg.gcp.gcs.GCSFileIO", 
opts.get("io-impl"));
+    }
+
+    @Test
+    public void appendRestGoogleWithUserProject() {
+        Map<String, String> opts = new HashMap<>();
+        appendRest(opts, props("iceberg.rest.security.type", "google",
+                "iceberg.rest.google.user-project", "my-billing-project"), 
Optional.empty());
+        Assertions.assertEquals("my-billing-project", 
opts.get("header.x-goog-user-project"));
+    }
+
+    @Test
+    public void appendRestGoogleSecurityTypeCaseInsensitive() {
+        Map<String, String> opts = new HashMap<>();
+        appendRest(opts, props("iceberg.rest.security.type", "GOOGLE"), 
Optional.empty());
+        
Assertions.assertEquals("org.apache.iceberg.gcp.auth.GoogleAuthManager", 
opts.get("rest.auth.type"));
+    }
+
+    @Test
+    public void appendRestOptionalGooglePropertiesWithoutGoogleAuth() {
+        Map<String, String> opts = new HashMap<>();
+        appendRest(opts, props("iceberg.rest.io-impl", 
"org.apache.iceberg.gcp.gcs.GCSFileIO",
+                "iceberg.rest.google.user-project", "billing-project"), 
Optional.empty());
+        Assertions.assertEquals("org.apache.iceberg.gcp.gcs.GCSFileIO", 
opts.get("io-impl"));
+        Assertions.assertEquals("billing-project", 
opts.get("header.x-goog-user-project"));
+        Assertions.assertFalse(opts.containsKey("rest.auth.type"));
+    }
+
+    @Test
+    public void appendRestBlankGoogleOptionsAreOmitted() {
+        Map<String, String> opts = new HashMap<>();
+        appendRest(opts, props("iceberg.rest.security.type", "google", 
"iceberg.rest.io-impl", " ",
+                "iceberg.rest.google.user-project", " "), Optional.empty());
+        Assertions.assertFalse(opts.containsKey("io-impl"));
+        Assertions.assertFalse(opts.containsKey("header.x-goog-user-project"));
+    }
+
+    @Test
+    public void googleRuntimeClassesAreAvailable() {
+        // WHY: iceberg-gcp does not depend on the Google SDK 
(google-cloud-storage is compileOnly
+        // upstream), so loading GoogleAuthManager/GCSFileIO by name succeeds 
even when the SDK is
+        // missing and only fails later, at the first GCS call. MUTATION: drop 
google-cloud-storage
+        // from the pom -> red (StorageOptions; GoogleCredentials also arrives 
via fe-filesystem-gcs).
+        ClassLoader loader = IcebergCatalogFactory.class.getClassLoader();
+        Assertions.assertDoesNotThrow(() -> 
Class.forName("org.apache.iceberg.gcp.auth.GoogleAuthManager", false, loader));
+        Assertions.assertDoesNotThrow(() -> 
Class.forName("org.apache.iceberg.gcp.gcs.GCSFileIO", false, loader));
+        Assertions.assertDoesNotThrow(() -> 
Class.forName("com.google.cloud.storage.StorageOptions", false, loader));
+        Assertions.assertDoesNotThrow(() -> 
Class.forName("com.google.auth.oauth2.GoogleCredentials", false, loader));
+    }
+
     @Test
     public void 
appendRestSigningBlockEmitsSigningKeysAndS3ExplicitCredentials() {
         // WHY: when signing-name is set, legacy emits 
rest.signing-name/sigv4-enabled/signing-region; for
@@ -893,6 +958,69 @@ public class IcebergCatalogFactoryTest {
                 "vended REST (no bound S3) must still translate s3.region -> 
client.region");
     }
 
+    @Test
+    public void buildCatalogPropertiesRestRawGcsHadoopKeysPinNativeGcsFileIo() 
{
+        // WHY: a REST catalog with an opaque warehouse configured only 
through raw fs.gs.* keys binds no typed
+        // GCS storage (chosenS3 empty). Before iceberg-gcp was bundled, 
ResolvingFileIO fell back to HadoopFileIO,
+        // which honors the keyfile; without the pin gs:// now resolves to 
GCSFileIO with ADC and ignores it.
+        // MUTATION: drop the raw fs.gs.* pin -> io-impl absent -> red.
+        Map<String, String> opts = 
IcebergCatalogFactory.buildCatalogProperties(
+                IcebergCatalogProperties.of(props("iceberg.catalog.type", 
"rest", "uri", "https://rest";,
+                        "warehouse", "analytics",
+                        "fs.gs.impl", 
"com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystem",
+                        "fs.gs.auth.type", "SERVICE_ACCOUNT_JSON_KEYFILE",
+                        "fs.gs.auth.service.account.json.keyfile", 
"/etc/gcs/key.json")),
+                Optional.empty(), false);
+        Assertions.assertEquals(NativeGcsResolvingFileIO.class.getName(), 
opts.get("io-impl"));
+    }
+
+    @Test
+    public void buildCatalogPropertiesRestRawGcsHadoopKeysKeepExplicitFileIo() 
{
+        // WHY: the raw fs.gs.* pin is a default only. MUTATION: put instead 
of putIfAbsent -> red.
+        Map<String, String> raw = IcebergCatalogFactory.buildCatalogProperties(
+                IcebergCatalogProperties.of(props("iceberg.catalog.type", 
"rest", "uri", "https://rest";,
+                        "fs.gs.auth.type", "SERVICE_ACCOUNT_JSON_KEYFILE",
+                        "io-impl", "org.apache.iceberg.hadoop.HadoopFileIO")),
+                Optional.empty(), false);
+        Assertions.assertEquals("org.apache.iceberg.hadoop.HadoopFileIO", 
raw.get("io-impl"));
+        Map<String, String> rest = 
IcebergCatalogFactory.buildCatalogProperties(
+                IcebergCatalogProperties.of(props("iceberg.catalog.type", 
"rest", "uri", "https://rest";,
+                        "fs.gs.auth.type", "SERVICE_ACCOUNT_JSON_KEYFILE",
+                        "iceberg.rest.io-impl", 
"org.apache.iceberg.gcp.gcs.GCSFileIO")),
+                Optional.empty(), false);
+        Assertions.assertEquals("org.apache.iceberg.gcp.gcs.GCSFileIO", 
rest.get("io-impl"));
+    }
+
+    @Test
+    public void 
buildCatalogPropertiesNonRestRawGcsHadoopKeysKeepSdkDefaultFileIo() {
+        // WHY: the raw fs.gs.* default is REST-only, like the typed-binding 
pin. hms / hadoop / jdbc default to
+        // HadoopFileIO and glue to S3FileIO; HMS emits no S3FileIO options, 
so pinning there would send s3a:// to
+        // an unconfigured S3FileIO. MUTATION: drop the TYPE_REST check from 
the raw fs.gs.* default
+        // -> io-impl present -> red.
+        for (String catalogType : List.of("hms", "hadoop", "jdbc", "glue")) {
+            Map<String, String> raw = new 
HashMap<>(Map.of("iceberg.catalog.type", catalogType,
+                    "uri", "thrift://localhost:9083", "warehouse", 
"s3a://bucket/warehouse",
+                    "iceberg.jdbc.uri", "jdbc:postgresql://localhost/iceberg",
+                    "jdbc.user", "user", "jdbc.password", "password"));
+            raw.putAll(Map.of("glue.access_key", "glue-ak", "glue.secret_key", 
"glue-sk",
+                    "glue.region", "us-east-1", "fs.gs.auth.type", 
"SERVICE_ACCOUNT_JSON_KEYFILE"));
+            Map<String, String> options = 
IcebergCatalogFactory.buildCatalogProperties(
+                    IcebergCatalogProperties.of(raw), Optional.empty(), false);
+            Assertions.assertFalse(options.containsKey("io-impl"), catalogType 
+ " raw fs.gs.*");
+        }
+    }
+
+    @Test
+    public void 
buildCatalogPropertiesRestWithoutGcsKeysKeepsSdkDefaultFileIo() {
+        // WHY: the pin must not override a REST server's recommended io-impl 
on catalogs that never configured
+        // GCS. MUTATION: pin every REST catalog -> io-impl present -> red.
+        Map<String, String> opts = 
IcebergCatalogFactory.buildCatalogProperties(
+                IcebergCatalogProperties.of(props("iceberg.catalog.type", 
"rest", "uri", "https://rest";,
+                        "warehouse", "analytics", "fs.s3a.endpoint", 
"https://minio:9000";)),
+                Optional.empty(), false);
+        Assertions.assertFalse(opts.containsKey("io-impl"));
+    }
+
     @Test
     public void 
buildCatalogPropertiesRestVendedResolvesRegionFromWidenedAliases() {
         // WHY: the empty-chosenS3 region fallback must scan the SAME region 
aliases legacy getRegionFromProperties
@@ -1143,7 +1271,7 @@ public class IcebergCatalogFactoryTest {
                 properties.put("iceberg.jdbc.uri", 
"jdbc:postgresql://localhost/iceberg");
                 Map<String, String> options = 
IcebergCatalogFactory.buildCatalogProperties(
                         IcebergCatalogProperties.of(properties), 
Optional.of(storage), false);
-                
Assertions.assertEquals("org.apache.iceberg.io.ResolvingFileIO", 
options.get("io-impl"));
+                
Assertions.assertEquals(NativeGcsResolvingFileIO.class.getName(), 
options.get("io-impl"));
                 
Assertions.assertEquals(GcpS3FileIOAwsClientFactory.class.getName(),
                         options.get(S3FileIOProperties.CLIENT_FACTORY));
                 Assertions.assertEquals(source, 
options.get("gs.credential_provider_type"));
@@ -1210,6 +1338,100 @@ public class IcebergCatalogFactoryTest {
         }
     }
 
+    @Test
+    void gcsNonNativeRestCatalogPinsGcsOnHadoopFileIo() {
+        // WHY: bundling iceberg-gcp makes upstream ResolvingFileIO route 
gs:// to GCSFileIO for every GCS
+        // catalog, while the Doris HMAC/anonymous path is fs.gs.*/fs.s3a.* 
behind HadoopFileIO. The pin
+        // therefore may not depend on the credential mode: neither of these 
catalogs has a native
+        // credential, so a pin kept inside the native-credential branch 
leaves io-impl unset and the
+        // FE reads gs:// through GCSFileIO with ADC instead of the configured 
keys.
+        // RESTCatalog is the one flavor whose SDK default is ResolvingFileIO, 
so the pin is needed here.
+        // MUTATION: pinning only when getNativeCredential() is present -> 
io-impl absent -> red.
+        List<Map<String, String>> rawVariants = List.of(
+                // Doris GCS HMAC: the S3-interoperability keys, read by the 
fs.s3a.* dialect.
+                Map.of("provider", "GCP", "warehouse", "gs://bucket/warehouse",
+                        "iceberg.catalog.type", "rest", "uri", 
"http://localhost:8181";,
+                        "gs.access_key", "ak", "gs.secret_key", "sk"),
+                // Public bucket: no credential at all.
+                Map.of("provider", "GCP", "warehouse", "gs://bucket/warehouse",
+                        "iceberg.catalog.type", "rest", "uri", 
"http://localhost:8181";,
+                        "gs.credential_provider_type", "ANONYMOUS"));
+        for (Map<String, String> raw : rawVariants) {
+            GcsFileSystemProperties storage = GcsFileSystemProperties.of(raw);
+            
Assertions.assertTrue(storage.getAuth().getNativeCredential().isEmpty(),
+                    "the test must exercise the non-ADC branch: " + 
storage.getAuth().getMode());
+            Map<String, String> options = 
IcebergCatalogFactory.buildCatalogProperties(
+                    IcebergCatalogProperties.of(raw), Optional.of(storage), 
false);
+            Assertions.assertEquals(NativeGcsResolvingFileIO.class.getName(), 
options.get("io-impl"),
+                    "credential mode " + storage.getAuth().getMode() + " must 
still pin gs on HadoopFileIO");
+        }
+    }
+
+    @Test
+    void gcsNonNativeNonRestCatalogsKeepTheirSdkDefaultFileIo() {
+        // WHY: only RESTCatalog defaults to ResolvingFileIO; HiveCatalog / 
HadoopCatalog / JdbcCatalog default to
+        // HadoopFileIO, which already reads gs/s3/s3a through the fs.* 
configuration Doris builds, and GlueCatalog
+        // defaults to S3FileIO with the s3.* options it emits itself. HMS 
also emits no S3FileIO options, so
+        // pinning NativeGcsResolvingFileIO there sends s3a:// to an 
unconfigured S3FileIO.
+        // MUTATION: pinning for every GCS binding regardless of flavor, or 
for any flavor besides rest
+        // -> io-impl present -> red.
+        for (String catalogType : List.of("hms", "hadoop", "jdbc", "glue")) {
+            for (Map<String, String> credential : 
List.of(Map.of("gs.access_key", "ak", "gs.secret_key", "sk"),
+                    Map.of("gs.credential_provider_type", "ANONYMOUS"))) {
+                Map<String, String> raw = new HashMap<>(credential);
+                raw.putAll(Map.of("provider", "GCP", "warehouse", 
"s3a://bucket/warehouse",
+                        "iceberg.catalog.type", catalogType, "uri", 
"thrift://localhost:9083",
+                        "iceberg.jdbc.uri", 
"jdbc:postgresql://localhost/iceberg",
+                        "jdbc.user", "user", "jdbc.password", "password"));
+                raw.putAll(Map.of("glue.access_key", "glue-ak", 
"glue.secret_key", "glue-sk",
+                        "glue.region", "us-east-1"));
+                Map<String, String> options = 
IcebergCatalogFactory.buildCatalogProperties(
+                        IcebergCatalogProperties.of(raw), 
Optional.of(GcsFileSystemProperties.of(raw)), false);
+                Assertions.assertFalse(options.containsKey("io-impl"), 
catalogType + " " + credential.keySet());
+            }
+        }
+    }
+
+    @Test
+    void gcsHmacHmsCatalogReadsS3aThroughHadoopFileIo() throws Exception {
+        // WHY: an existing HMS catalog on GCS HMAC keys with s3a:// metadata 
locations reads them through
+        // HiveCatalog's default HadoopFileIO and the fs.s3a.* configuration; 
routing s3a:// to S3FileIO fails
+        // because the HMS options carry no s3.endpoint / keys / client.region.
+        // MUTATION: pinning NativeGcsResolvingFileIO for HMS HMAC -> s3a:// 
resolves to S3FileIO -> red.
+        Map<String, String> raw = Map.of("provider", "GCP", "warehouse", 
"s3a://bucket/warehouse",
+                "iceberg.catalog.type", "hms", "uri", 
"thrift://localhost:9083",
+                "gs.access_key", "ak", "gs.secret_key", "sk");
+        GcsFileSystemProperties storage = GcsFileSystemProperties.of(raw);
+        Map<String, String> options = 
IcebergCatalogFactory.buildCatalogProperties(
+                IcebergCatalogProperties.of(raw), Optional.of(storage), false);
+        Configuration conf = 
IcebergCatalogFactory.buildHadoopConfiguration(raw,
+                storage.toHadoopConfigurationMap());
+        // Replace the Hadoop transport only, so the real FileIO dispatch runs 
without a GCS service.
+        conf.set("fs.s3a.impl", RawLocalFileSystem.class.getName());
+        conf.setBoolean("fs.s3a.impl.disable.cache", true);
+        // HiveCatalog.initialize: no io-impl -> new HadoopFileIO(conf), else 
CatalogUtil.loadFileIO.
+        String ioImpl = options.get("io-impl");
+        try (FileIO io = ioImpl == null ? new HadoopFileIO(conf) : 
CatalogUtil.loadFileIO(ioImpl, options, conf)) {
+            Assertions.assertInstanceOf(HadoopInputFile.class,
+                    
io.newInputFile("s3a://bucket/warehouse/db/t/metadata/v1.metadata.json", 10));
+        }
+    }
+
+    @Test
+    void gcsRestCatalogPreservesExplicitGoogleFileIo() {
+        // WHY: an operator naming GCSFileIO explicitly (the google security 
type's documented setup) must
+        // keep it; the gs:// pin is a default, so it may only putIfAbsent.
+        // MUTATION: opts.put(io-impl) in the GCS block -> this explicit 
choice is overwritten -> red.
+        Map<String, String> raw = new HashMap<>(Map.of("provider", "GCP", 
"warehouse", "gs://bucket/warehouse",
+                "iceberg.catalog.type", "rest", "uri", "http://localhost:8181";,
+                "gs.access_key", "ak", "gs.secret_key", "sk",
+                "iceberg.rest.io-impl", 
"org.apache.iceberg.gcp.gcs.GCSFileIO"));
+        GcsFileSystemProperties storage = GcsFileSystemProperties.of(raw);
+        Map<String, String> options = 
IcebergCatalogFactory.buildCatalogProperties(
+                IcebergCatalogProperties.of(raw), Optional.of(storage), false);
+        Assertions.assertEquals("org.apache.iceberg.gcp.gcs.GCSFileIO", 
options.get("io-impl"));
+    }
+
     @Test
     void nativeGcpWarehouseAliasesSelectGoogleHadoopFileSystem() throws 
Exception {
         for (String scheme : List.of("gs", "s3", "s3a", "S3A")) {
diff --git 
a/fe/fe-connector/fe-connector-iceberg/src/test/java/org/apache/doris/connector/iceberg/IcebergConnectorValidatePropertiesTest.java
 
b/fe/fe-connector/fe-connector-iceberg/src/test/java/org/apache/doris/connector/iceberg/IcebergConnectorValidatePropertiesTest.java
index 7241b620a39..cdae5431aa9 100644
--- 
a/fe/fe-connector/fe-connector-iceberg/src/test/java/org/apache/doris/connector/iceberg/IcebergConnectorValidatePropertiesTest.java
+++ 
b/fe/fe-connector/fe-connector-iceberg/src/test/java/org/apache/doris/connector/iceberg/IcebergConnectorValidatePropertiesTest.java
@@ -52,7 +52,7 @@ public class IcebergConnectorValidatePropertiesTest {
 
     @Test
     public void restFlavorRulesReachableThroughProvider() {
-        Assertions.assertEquals("Invalid security type: bogus. Supported 
values are: none, oauth2",
+        Assertions.assertEquals("Invalid security type: bogus. Supported 
values are: none, oauth2, google",
                 rejectMessage(props("iceberg.catalog.type", "rest", 
"iceberg.rest.security.type", "bogus")));
         // valid REST (default none security) accepted.
         PROVIDER.validateProperties(props("iceberg.catalog.type", "rest", 
"iceberg.rest.uri", "http://r";));
diff --git 
a/fe/fe-connector/fe-connector-metastore-iceberg/src/main/java/org/apache/doris/connector/metastore/iceberg/rest/IcebergRestMetaStoreProperties.java
 
b/fe/fe-connector/fe-connector-metastore-iceberg/src/main/java/org/apache/doris/connector/metastore/iceberg/rest/IcebergRestMetaStoreProperties.java
index fd0937ee982..0ce340e90b3 100644
--- 
a/fe/fe-connector/fe-connector-metastore-iceberg/src/main/java/org/apache/doris/connector/metastore/iceberg/rest/IcebergRestMetaStoreProperties.java
+++ 
b/fe/fe-connector/fe-connector-metastore-iceberg/src/main/java/org/apache/doris/connector/metastore/iceberg/rest/IcebergRestMetaStoreProperties.java
@@ -32,7 +32,7 @@ import java.util.Map;
  * {@code IcebergCatalogFactory}). Ports the legacy {@code 
IcebergRestProperties.initNormalizeAndCheckProps}
  * validation verbatim (§4 of the P6-T10 design), in observable fire order:
  * <ol>
- *   <li>security-type enum (none/oauth2)</li>
+ *   <li>security-type enum (none/oauth2/google)</li>
  *   <li>AWS credentials-provider mode enum</li>
  *   <li>OAuth2 scope-only-with-credential (eager)</li>
  *   <li>OAuth2 requires credential-or-token (eager)</li>
@@ -86,9 +86,17 @@ public final class IcebergRestMetaStoreProperties extends 
AbstractMetaStorePrope
     private String socketTimeoutMs = "60000";
 
     @ConnectorProperty(names = {"iceberg.rest.security.type"}, required = 
false,
-            description = "The security type of the iceberg rest catalog 
service, optional: (none, oauth2).")
+            description = "The security type of the iceberg rest catalog 
service, optional: (none, oauth2, google).")
     private String securityType = "none";
 
+    @ConnectorProperty(names = {"iceberg.rest.io-impl"}, required = false,
+            description = "The FileIO implementation for the iceberg rest 
catalog service.")
+    private String ioImpl;
+
+    @ConnectorProperty(names = {"iceberg.rest.google.user-project"}, required 
= false,
+            description = "The Google project to be billed for using the 
iceberg rest catalog service.")
+    private String googleUserProject;
+
     @ConnectorProperty(names = {"iceberg.rest.credentials_provider_type"}, 
required = false,
             description = "The credentials provider type for AWS 
authentication.")
     private String credentialsProviderType = "DEFAULT";
@@ -210,6 +218,14 @@ public final class IcebergRestMetaStoreProperties extends 
AbstractMetaStorePrope
         return securityType;
     }
 
+    public String getIoImpl() {
+        return ioImpl;
+    }
+
+    public String getGoogleUserProject() {
+        return googleUserProject;
+    }
+
     public String getCredentialsProviderType() {
         return credentialsProviderType;
     }
@@ -290,9 +306,10 @@ public final class IcebergRestMetaStoreProperties extends 
AbstractMetaStorePrope
     @Override
     public void validate() {
         // 1. security type (legacy validateSecurityType: 
Security.valueOf(securityType.toUpperCase())).
-        if (!"none".equalsIgnoreCase(securityType) && 
!"oauth2".equalsIgnoreCase(securityType)) {
+        if (!"none".equalsIgnoreCase(securityType) && 
!"oauth2".equalsIgnoreCase(securityType)
+                && !"google".equalsIgnoreCase(securityType)) {
             throw new IllegalArgumentException("Invalid security type: " + 
securityType
-                    + ". Supported values are: none, oauth2");
+                    + ". Supported values are: none, oauth2, google");
         }
         // 2. AWS credentials-provider mode (legacy 
AwsCredentialsProviderMode.fromString).
         validateCredentialsProviderMode();
diff --git 
a/fe/fe-connector/fe-connector-metastore-iceberg/src/test/java/org/apache/doris/connector/metastore/iceberg/rest/IcebergRestMetaStorePropertiesTest.java
 
b/fe/fe-connector/fe-connector-metastore-iceberg/src/test/java/org/apache/doris/connector/metastore/iceberg/rest/IcebergRestMetaStorePropertiesTest.java
index 608b17f8d73..3b4d3d40be6 100644
--- 
a/fe/fe-connector/fe-connector-metastore-iceberg/src/test/java/org/apache/doris/connector/metastore/iceberg/rest/IcebergRestMetaStorePropertiesTest.java
+++ 
b/fe/fe-connector/fe-connector-metastore-iceberg/src/test/java/org/apache/doris/connector/metastore/iceberg/rest/IcebergRestMetaStorePropertiesTest.java
@@ -80,7 +80,7 @@ public class IcebergRestMetaStorePropertiesTest {
 
     @Test
     public void rule1InvalidSecurityType() {
-        Assertions.assertEquals("Invalid security type: bogus. Supported 
values are: none, oauth2",
+        Assertions.assertEquals("Invalid security type: bogus. Supported 
values are: none, oauth2, google",
                 validateError(raw("iceberg.rest.security.type", "bogus")));
         // case-insensitive accept (mirrors Security.valueOf(toUpperCase)).
         IcebergRestMetaStoreProperties.of(raw("iceberg.rest.security.type", 
"OAuth2",
@@ -96,6 +96,25 @@ public class IcebergRestMetaStorePropertiesTest {
         
IcebergRestMetaStoreProperties.of(raw("iceberg.rest.credentials_provider_type", 
"instance-profile")).validate();
     }
 
+    @Test
+    public void googleSecurityBindsOptionsWithoutStaticCredentials() {
+        for (String security : new String[] {"google", "GOOGLE", "Google"}) {
+            IcebergRestMetaStoreProperties properties = 
IcebergRestMetaStoreProperties.of(raw(
+                    "iceberg.rest.security.type", security,
+                    "iceberg.rest.io-impl", 
"org.apache.iceberg.gcp.gcs.GCSFileIO",
+                    "iceberg.rest.google.user-project", "billing-project"));
+            properties.validate();
+            Assertions.assertEquals("org.apache.iceberg.gcp.gcs.GCSFileIO", 
properties.getIoImpl());
+            Assertions.assertEquals("billing-project", 
properties.getGoogleUserProject());
+        }
+    }
+
+    @Test
+    public void googleSecurityPreservesOauth2UserSessionRequirement() {
+        Assertions.assertEquals("iceberg.rest.session=user requires 
iceberg.rest.security.type=oauth2",
+                validateError(raw("iceberg.rest.security.type", "google", 
"iceberg.rest.session", "user")));
+    }
+
     @Test
     public void rule3OAuth2ScopeOnlyWithCredentialNotToken() {
         Assertions.assertEquals("OAuth2 scope is only applicable when using 
credential, not token",
@@ -180,7 +199,7 @@ public class IcebergRestMetaStorePropertiesTest {
         // WHY: rule 1 (security type) runs first. Even with a role_arn (rule 
5) and an AK-only (rule 10)
         // also violated, the security-type error must surface. MUTATION: 
reordering checks would surface a
         // different message.
-        Assertions.assertEquals("Invalid security type: bogus. Supported 
values are: none, oauth2",
+        Assertions.assertEquals("Invalid security type: bogus. Supported 
values are: none, oauth2, google",
                 validateError(raw("iceberg.rest.security.type", "bogus",
                         "iceberg.rest.role_arn", "arn", 
"iceberg.rest.access-key-id", "ak")));
     }
diff --git a/fe/fe-iceberg-common/pom.xml b/fe/fe-iceberg-common/pom.xml
index d139e7aa15b..7254c70e832 100644
--- a/fe/fe-iceberg-common/pom.xml
+++ b/fe/fe-iceberg-common/pom.xml
@@ -36,6 +36,19 @@ under the License.
             <artifactId>iceberg-aws</artifactId>
             <version>${iceberg.version}</version>
         </dependency>
+        <!-- NativeGcsResolvingFileIO extends ResolvingFileIO (a 
HadoopConfigurable). Both consumers bundle
+             iceberg-core and hadoop-common themselves, so neither is shipped 
from here. -->
+        <dependency>
+            <groupId>org.apache.iceberg</groupId>
+            <artifactId>iceberg-core</artifactId>
+            <version>${iceberg.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-common</artifactId>
+            <scope>provided</scope>
+        </dependency>
         <dependency>
             <groupId>org.apache.doris</groupId>
             <artifactId>fe-filesystem-gcs</artifactId>
diff --git 
a/fe/fe-iceberg-common/src/main/java/org/apache/iceberg/io/NativeGcsResolvingFileIO.java
 
b/fe/fe-iceberg-common/src/main/java/org/apache/iceberg/io/NativeGcsResolvingFileIO.java
new file mode 100644
index 00000000000..8ee06c89b91
--- /dev/null
+++ 
b/fe/fe-iceberg-common/src/main/java/org/apache/iceberg/io/NativeGcsResolvingFileIO.java
@@ -0,0 +1,47 @@
+// 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.iceberg.io;
+
+/**
+ * A {@link ResolvingFileIO} that keeps {@code gs://} locations on {@code 
HadoopFileIO}.
+ *
+ * <p>Doris configures GCS access as Hadoop properties: native credentials 
(credential provider type,
+ * service-account impersonation) as {@code fs.gs.*}, and HMAC 
interoperability keys or anonymous access as
+ * {@code fs.s3a.*}. Only the Hadoop filesystems read them. Upstream 
ResolvingFileIO
+ * routes {@code gs} to {@code GCSFileIO} whenever iceberg-gcp is on the 
classpath and falls back to
+ * HadoopFileIO only when that class is missing. The plugins bundle 
iceberg-gcp for the REST catalog's
+ * {@code GoogleAuthManager} and an explicitly chosen {@code GCSFileIO}, so 
this class pins the default
+ * routing instead of relying on that class being absent. Every other scheme 
resolves exactly as upstream.
+ *
+ * <p>It lives in {@code org.apache.iceberg.io} because {@code 
implFromLocation} is package-private; the
+ * override only takes effect when this class and iceberg-core share a class 
loader, which holds for the
+ * FE connector plugin and the BE metadata scanner, both of which bundle 
iceberg-core themselves. Its class
+ * name is part of serialized Iceberg scan tasks, so it must stay loadable on 
both sides.
+ */
+public class NativeGcsResolvingFileIO extends ResolvingFileIO {
+    private static final long serialVersionUID = 1L;
+
+    private static final String GCS_FILE_IO_IMPL = 
"org.apache.iceberg.gcp.gcs.GCSFileIO";
+    private static final String HADOOP_FILE_IO_IMPL = 
"org.apache.iceberg.hadoop.HadoopFileIO";
+
+    @Override
+    String implFromLocation(String location) {
+        String impl = super.implFromLocation(location);
+        return GCS_FILE_IO_IMPL.equals(impl) ? HADOOP_FILE_IO_IMPL : impl;
+    }
+}
diff --git a/fe/pom.xml b/fe/pom.xml
index 9afb9a855ea..fc4225ffbc5 100644
--- a/fe/pom.xml
+++ b/fe/pom.xml
@@ -397,6 +397,9 @@ under the License.
         <postgresql.version>42.7.13</postgresql.version>
         <hadoop.version>3.4.2</hadoop.version>
         <gcs-connector.version>3.1.18</gcs-connector.version>
+        <!-- Google SDK bundled with iceberg-gcp by the FE iceberg connector 
plugin and the BE
+             iceberg-metadata-scanner; one property so both sides of a catalog 
run the same client. -->
+        <google-cloud-storage.version>2.67.0</google-cloud-storage.version>
         <re2j.version>1.8</re2j.version>
         
<hadoop.thirdparty.guava.version>1.2.0</hadoop.thirdparty.guava.version>
         
<hadoop.thirdparty.protobuf_3_25.version>1.5.0</hadoop.thirdparty.protobuf_3_25.version>


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

Reply via email to