yuqi1129 commented on code in PR #11186:
URL: https://github.com/apache/gravitino/pull/11186#discussion_r3310481479


##########
spark-connector/v3.4/spark/build.gradle.kts:
##########
@@ -134,6 +134,15 @@ dependencies {
   testImplementation(libs.mysql.driver)
   testImplementation(libs.postgresql.driver)
   testImplementation(libs.testcontainers)
+  testImplementation(libs.hadoop3.aws)
+  // hadoop-aws declares hadoop-client-api as provided; add it explicitly so 
S3AFileSystem can load
+  // org.apache.hadoop.fs.impl.prefetch.PrefetchingStatistics (added in 3.3.5) 
at runtime.
+  testImplementation(libs.hadoop3.client.api)
+  // Iceberg's GlueCatalog references several AWS SDK modules at runtime; must 
be on test classpath
+  testImplementation(libs.aws.glue)
+  testImplementation(libs.aws.sts)
+  testImplementation(libs.aws.s3)
+  testImplementation(libs.aws.kms)

Review Comment:
   ditto



##########
spark-connector/v3.5/spark/build.gradle.kts:
##########
@@ -136,6 +136,16 @@ dependencies {
   testImplementation(libs.mysql.driver)
   testImplementation(libs.postgresql.driver)
   testImplementation(libs.testcontainers)
+  testImplementation(libs.hadoop3.aws)
+  // hadoop-aws declares hadoop-client-api as provided; add it explicitly so 
S3AFileSystem can load
+  // org.apache.hadoop.fs.impl.prefetch.PrefetchingStatistics (added in 3.3.5) 
at runtime.
+  testImplementation(libs.hadoop3.client.api)
+  // Iceberg's GlueCatalog references several AWS SDK modules at runtime; must 
be on test classpath
+  testImplementation(libs.aws.glue)
+  testImplementation(libs.aws.sts)
+  testImplementation(libs.aws.s3)

Review Comment:
   sort this part.



##########
spark-connector/spark-common/src/test/java/org/apache/gravitino/spark/connector/integration/test/util/SparkUtilIT.java:
##########
@@ -134,12 +135,45 @@ protected List<String> getTableMetadata(String 
getTableMetadataSql) {
   }
 
   // Create SparkTableInfo from SparkBaseTable retrieved from LogicalPlan.
+  // In Spark 3.3/3.5: DESC TABLE EXTENDED returns DescribeRelation.
+  // In Spark 3.4: DESC TABLE EXTENDED returns DescribeTableCommand (different 
class hierarchy).
+  // Use the v2 Catalog API (CatalogManager + TableCatalog.loadTable) for 
cross-version
+  // compatibility.
   protected SparkTableInfo getTableInfo(String tableName) {
-    Dataset ds = getSparkSession().sql("DESC TABLE EXTENDED " + tableName);
-    CommandResult result = (CommandResult) ds.logicalPlan();
-    DescribeRelation relation = (DescribeRelation) result.commandLogicalPlan();
-    ResolvedTable table = (ResolvedTable) relation.child();
-    return SparkTableInfo.create(table.table());
+    CatalogManager catalogManager = 
getSparkSession().sessionState().catalogManager();
+
+    // Parse tableName: could be short (tbl), partially-qualified (db.tbl),
+    // or fully-qualified (cat.db.tbl).
+    String[] parts = tableName.split("\\.");
+    Identifier identifier;
+    TableCatalog tableCatalog;
+    if (parts.length == 1) {
+      // Short table name: use current catalog + current V2 namespace.
+      // catalog().currentDatabase() returns the V1 Hive session catalog 
database and is NOT
+      // updated when USE <db> is issued against a V2 catalog (e.g. Glue) in 
Spark 3.3.
+      // catalogManager.currentNamespace() reflects the V2 namespace correctly.
+      CatalogPlugin currentCatalog = catalogManager.currentCatalog();
+      String[] currentNamespace = catalogManager.currentNamespace();
+      identifier = Identifier.of(currentNamespace, parts[0]);
+      tableCatalog = (TableCatalog) currentCatalog;
+    } else if (parts.length == 2) {
+      // Partially qualified: db.table
+      identifier = Identifier.of(new String[] {parts[0]}, parts[1]);
+      CatalogPlugin currentCatalog = catalogManager.currentCatalog();
+      tableCatalog = (TableCatalog) currentCatalog;
+    } else if (parts.length == 3) {
+      // Fully qualified: cat.db.table — namespace is only the db part, not 
the catalog
+      identifier = Identifier.of(new String[] {parts[1]}, parts[2]);
+      CatalogPlugin catalog = catalogManager.catalog(parts[0]);
+      tableCatalog = (TableCatalog) catalog;
+    } else {
+      throw new IllegalArgumentException("Invalid table name format: " + 
tableName);
+    }
+    try {
+      return SparkTableInfo.create(tableCatalog.loadTable(identifier));
+    } catch (NoSuchTableException e) {
+      throw new RuntimeException(e);

Review Comment:
   Why do we need to catch `NoSuchTableException`? Is it just the subclass of 
`RuntimeException`?



##########
spark-connector/spark-common/src/main/java/org/apache/gravitino/spark/connector/glue/GravitinoGlueCredentialsProvider.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * 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.gravitino.spark.connector.glue;
+
+import com.google.common.base.Preconditions;
+import java.util.Map;
+import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
+import software.amazon.awssdk.auth.credentials.AwsCredentials;
+import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
+import software.amazon.awssdk.core.exception.SdkClientException;
+
+/**
+ * AWS credentials provider for Iceberg {@code GlueCatalog} that reads static 
credentials from a
+ * properties map.
+ *
+ * <p>Iceberg 1.10+ loads credentials via {@code client.credentials-provider}. 
This class is
+ * instantiated dynamically by Iceberg's {@code AwsClientProperties} using the 
{@code create(Map)}
+ * static factory. The properties map contains the {@code 
client.credentials-provider.*} entries
+ * with their prefix stripped, i.e. {@code access-key-id} and {@code 
secret-access-key}.
+ */
+public class GravitinoGlueCredentialsProvider implements 
AwsCredentialsProvider {

Review Comment:
   I remember that there already exist several similar classes. Can you try to 
reuse them?



##########
spark-connector/spark-common/src/main/java/org/apache/gravitino/spark/connector/glue/GluePropertiesConverter.java:
##########
@@ -0,0 +1,152 @@
+/*
+ * 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.gravitino.spark.connector.glue;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.gravitino.spark.connector.PropertiesConverter;
+import org.apache.iceberg.CatalogProperties;
+
+/**
+ * Transform AWS Glue catalog properties between Apache Spark and Apache 
Gravitino.
+ *
+ * <p>This converter handles the property mapping for:
+ *
+ * <ul>
+ *   <li>Non-Iceberg tables: pass through AWS credentials and region to 
HiveTableCatalog
+ *   <li>Iceberg tables: map Gravitino Glue properties to Iceberg's 
GlueCatalog configuration
+ * </ul>
+ */
+public class GluePropertiesConverter implements PropertiesConverter {
+
+  public static final String GLUE_CATALOG_IMPL = 
"org.apache.iceberg.aws.glue.GlueCatalog";

Review Comment:
   Can we use GlueCatalog.class.getName()



##########
spark-connector/spark-common/src/main/java/org/apache/gravitino/spark/connector/glue/GluePropertiesConverter.java:
##########
@@ -0,0 +1,152 @@
+/*
+ * 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.gravitino.spark.connector.glue;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.gravitino.spark.connector.PropertiesConverter;
+import org.apache.iceberg.CatalogProperties;
+
+/**
+ * Transform AWS Glue catalog properties between Apache Spark and Apache 
Gravitino.
+ *
+ * <p>This converter handles the property mapping for:
+ *
+ * <ul>
+ *   <li>Non-Iceberg tables: pass through AWS credentials and region to 
HiveTableCatalog
+ *   <li>Iceberg tables: map Gravitino Glue properties to Iceberg's 
GlueCatalog configuration
+ * </ul>
+ */
+public class GluePropertiesConverter implements PropertiesConverter {
+
+  public static final String GLUE_CATALOG_IMPL = 
"org.apache.iceberg.aws.glue.GlueCatalog";
+  public static final String GLUE_ID = "glue.id";
+  public static final String GLUE_ENDPOINT = "glue.endpoint";
+  public static final String CLIENT_REGION = "client.region";
+  public static final String CLIENT_CREDENTIALS_PROVIDER = 
"client.credentials-provider";
+  // GravitinoGlueCredentialsProvider implements AwsCredentialsProvider with 
create(Map) so that
+  // Iceberg's AwsClientProperties can instantiate it dynamically via 
client.credentials-provider.
+  public static final String GRAVITINO_GLUE_CREDENTIALS_PROVIDER =
+      
"org.apache.gravitino.spark.connector.glue.GravitinoGlueCredentialsProvider";
+  public static final String AWS_ACCESS_KEY_ID = "aws-access-key-id";
+  public static final String AWS_SECRET_ACCESS_KEY = "aws-secret-access-key";
+  public static final String AWS_REGION = "aws-region";
+  public static final String AWS_GLUE_CATALOG_ID = "aws-glue-catalog-id";
+  public static final String AWS_GLUE_ENDPOINT = "aws-glue-endpoint";
+
+  private static class GluePropertiesConverterHolder {
+    private static final GluePropertiesConverter INSTANCE = new 
GluePropertiesConverter();
+  }
+
+  private GluePropertiesConverter() {}
+
+  /**
+   * Returns the singleton instance of {@link GluePropertiesConverter}.
+   *
+   * @return the singleton instance
+   */
+  public static GluePropertiesConverter getInstance() {
+    return GluePropertiesConverterHolder.INSTANCE;
+  }
+
+  /**
+   * Transform Gravitino Glue catalog properties to Spark catalog properties 
for HiveTableCatalog.
+   *
+   * <p>For Glue-backed Hive tables, Spark uses the AWS SDK directly through 
the Hive metastore
+   * compatibility layer. The properties are passed through to enable Glue API 
access.
+   */
+  @Override
+  public Map<String, String> toSparkCatalogProperties(Map<String, String> 
properties) {
+    Preconditions.checkArgument(properties != null, "Glue Catalog properties 
should not be null");
+    HashMap<String, String> all = new HashMap<>();
+    String region = properties.get(AWS_REGION);
+    if (StringUtils.isNotBlank(region)) {
+      all.put("aws.region", region);

Review Comment:
   You may need to add a map to maintain the mapping of Spark key to Gravitino 
key.



##########
spark-connector/spark-common/src/main/java/org/apache/gravitino/spark/connector/glue/GravitinoGlueCatalog.java:
##########
@@ -0,0 +1,350 @@
+/*
+ * 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.gravitino.spark.connector.glue;
+
+import com.google.common.base.Preconditions;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.gravitino.catalog.glue.GlueConstants;
+import org.apache.gravitino.spark.connector.PropertiesConverter;
+import org.apache.gravitino.spark.connector.SparkTransformConverter;
+import org.apache.gravitino.spark.connector.SparkTypeConverter;
+import org.apache.gravitino.spark.connector.catalog.BaseCatalog;
+import org.apache.gravitino.spark.connector.hive.SparkHiveTable;
+import org.apache.gravitino.spark.connector.hive.SparkHiveTypeConverter;
+import org.apache.gravitino.spark.connector.iceberg.SparkIcebergTable;
+import org.apache.iceberg.spark.SparkCatalog;
+import org.apache.iceberg.spark.source.SparkTable;
+import org.apache.kyuubi.spark.connector.hive.HiveTable;
+import org.apache.kyuubi.spark.connector.hive.HiveTableCatalog;
+import org.apache.spark.sql.catalyst.analysis.NamespaceAlreadyExistsException;
+import org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException;
+import org.apache.spark.sql.catalyst.analysis.NoSuchTableException;
+import org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException;
+import org.apache.spark.sql.connector.catalog.Identifier;
+import org.apache.spark.sql.connector.catalog.SupportsNamespaces;
+import org.apache.spark.sql.connector.catalog.Table;
+import org.apache.spark.sql.connector.catalog.TableCatalog;
+import org.apache.spark.sql.connector.expressions.Transform;
+import org.apache.spark.sql.types.DataTypes;
+import org.apache.spark.sql.types.StructField;
+import org.apache.spark.sql.types.StructType;
+import org.apache.spark.sql.util.CaseInsensitiveStringMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Gravitino Glue catalog implementation for Apache Spark.
+ *
+ * <p>This catalog handles mixed table types stored in AWS Glue Data Catalog:
+ *
+ * <ul>
+ *   <li>Non-Iceberg tables (Hive, Delta, Parquet): routed to HiveTableCatalog 
for I/O
+ *   <li>Iceberg tables: routed to Iceberg's GlueCatalog for I/O
+ * </ul>
+ *
+ * <p>Table routing is based on the {@code table-format} property in Glue 
table parameters. Tables
+ * with {@code table-format=ICEBERG} are delegated to the Iceberg backend.
+ *
+ * <p>Derby sync: Gravitino creates/modifies tables in AWS Glue. 
HiveTableCatalog (used as
+ * sparkCatalog) uses an embedded Derby metastore for metadata validation. We 
must keep Derby in
+ * sync with Glue for loadSparkTable() to succeed. Derby is populated lazily 
on createTable() and
+ * loadTable(), and cleaned up on dropTable()/purgeTable()/renameTable().
+ */
+public class GravitinoGlueCatalog extends BaseCatalog {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(GravitinoGlueCatalog.class);
+
+  // Lazily initialized Iceberg GlueCatalog for Iceberg tables
+  private volatile SparkCatalog icebergGlueCatalog;
+
+  // Store original config for Iceberg catalog initialization
+  private String catalogName;
+  private Map<String, String> catalogProperties;
+
+  /** Creates a new GravitinoGlueCatalog. */
+  public GravitinoGlueCatalog() {}
+
+  /**
+   * Creates a new HiveTableCatalog instance. Override in tests to inject mock 
instances.
+   *
+   * @return a new HiveTableCatalog
+   */
+  protected HiveTableCatalog createHiveTableCatalog() {
+    return new HiveTableCatalog();
+  }
+
+  @Override
+  protected TableCatalog createAndInitSparkCatalog(
+      String name, CaseInsensitiveStringMap options, Map<String, String> 
properties) {
+    this.catalogName = name;
+    this.catalogProperties = properties;
+
+    TableCatalog hiveCatalog = createHiveTableCatalog();
+    Map<String, String> all =
+        getPropertiesConverter().toSparkCatalogProperties(options, properties);
+    hiveCatalog.initialize(name, new CaseInsensitiveStringMap(all));
+    return hiveCatalog;
+  }
+
+  /**
+   * Routes Spark table loading to the correct backend after Gravitino creates 
the table.
+   *
+   * <p>Iceberg tables are loaded from the Iceberg GlueCatalog; they are never 
registered in Derby.
+   * Hive tables are loaded from Derby, syncing from Glue first if the entry 
is missing.
+   */
+  @Override
+  protected Table loadSparkTable(Identifier ident) {
+    try {
+      org.apache.gravitino.rel.Table gravitinoTable = 
loadGravitinoTable(ident);
+      if (isIcebergTable(gravitinoTable)) {
+        return loadIcebergSparkTable(ident, getOrCreateIcebergGlueCatalog());
+      }
+      syncNamespaceToDerby(ident.namespace());

Review Comment:
   What is it used for? Why do we sync the namespace to Derby?



##########
spark-connector/spark-common/src/main/java/org/apache/gravitino/spark/connector/glue/GravitinoGlueCatalog.java:
##########
@@ -0,0 +1,350 @@
+/*
+ * 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.gravitino.spark.connector.glue;
+
+import com.google.common.base.Preconditions;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.gravitino.catalog.glue.GlueConstants;
+import org.apache.gravitino.spark.connector.PropertiesConverter;
+import org.apache.gravitino.spark.connector.SparkTransformConverter;
+import org.apache.gravitino.spark.connector.SparkTypeConverter;
+import org.apache.gravitino.spark.connector.catalog.BaseCatalog;
+import org.apache.gravitino.spark.connector.hive.SparkHiveTable;
+import org.apache.gravitino.spark.connector.hive.SparkHiveTypeConverter;
+import org.apache.gravitino.spark.connector.iceberg.SparkIcebergTable;
+import org.apache.iceberg.spark.SparkCatalog;
+import org.apache.iceberg.spark.source.SparkTable;
+import org.apache.kyuubi.spark.connector.hive.HiveTable;
+import org.apache.kyuubi.spark.connector.hive.HiveTableCatalog;
+import org.apache.spark.sql.catalyst.analysis.NamespaceAlreadyExistsException;
+import org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException;
+import org.apache.spark.sql.catalyst.analysis.NoSuchTableException;
+import org.apache.spark.sql.catalyst.analysis.TableAlreadyExistsException;
+import org.apache.spark.sql.connector.catalog.Identifier;
+import org.apache.spark.sql.connector.catalog.SupportsNamespaces;
+import org.apache.spark.sql.connector.catalog.Table;
+import org.apache.spark.sql.connector.catalog.TableCatalog;
+import org.apache.spark.sql.connector.expressions.Transform;
+import org.apache.spark.sql.types.DataTypes;
+import org.apache.spark.sql.types.StructField;
+import org.apache.spark.sql.types.StructType;
+import org.apache.spark.sql.util.CaseInsensitiveStringMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Gravitino Glue catalog implementation for Apache Spark.
+ *
+ * <p>This catalog handles mixed table types stored in AWS Glue Data Catalog:
+ *
+ * <ul>
+ *   <li>Non-Iceberg tables (Hive, Delta, Parquet): routed to HiveTableCatalog 
for I/O
+ *   <li>Iceberg tables: routed to Iceberg's GlueCatalog for I/O
+ * </ul>
+ *
+ * <p>Table routing is based on the {@code table-format} property in Glue 
table parameters. Tables
+ * with {@code table-format=ICEBERG} are delegated to the Iceberg backend.
+ *
+ * <p>Derby sync: Gravitino creates/modifies tables in AWS Glue. 
HiveTableCatalog (used as
+ * sparkCatalog) uses an embedded Derby metastore for metadata validation. We 
must keep Derby in
+ * sync with Glue for loadSparkTable() to succeed. Derby is populated lazily 
on createTable() and
+ * loadTable(), and cleaned up on dropTable()/purgeTable()/renameTable().
+ */
+public class GravitinoGlueCatalog extends BaseCatalog {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(GravitinoGlueCatalog.class);
+
+  // Lazily initialized Iceberg GlueCatalog for Iceberg tables
+  private volatile SparkCatalog icebergGlueCatalog;
+
+  // Store original config for Iceberg catalog initialization
+  private String catalogName;
+  private Map<String, String> catalogProperties;
+
+  /** Creates a new GravitinoGlueCatalog. */
+  public GravitinoGlueCatalog() {}
+
+  /**
+   * Creates a new HiveTableCatalog instance. Override in tests to inject mock 
instances.
+   *
+   * @return a new HiveTableCatalog
+   */
+  protected HiveTableCatalog createHiveTableCatalog() {
+    return new HiveTableCatalog();
+  }
+
+  @Override
+  protected TableCatalog createAndInitSparkCatalog(
+      String name, CaseInsensitiveStringMap options, Map<String, String> 
properties) {
+    this.catalogName = name;
+    this.catalogProperties = properties;
+
+    TableCatalog hiveCatalog = createHiveTableCatalog();
+    Map<String, String> all =
+        getPropertiesConverter().toSparkCatalogProperties(options, properties);
+    hiveCatalog.initialize(name, new CaseInsensitiveStringMap(all));
+    return hiveCatalog;
+  }
+
+  /**
+   * Routes Spark table loading to the correct backend after Gravitino creates 
the table.
+   *
+   * <p>Iceberg tables are loaded from the Iceberg GlueCatalog; they are never 
registered in Derby.
+   * Hive tables are loaded from Derby, syncing from Glue first if the entry 
is missing.
+   */
+  @Override
+  protected Table loadSparkTable(Identifier ident) {
+    try {
+      org.apache.gravitino.rel.Table gravitinoTable = 
loadGravitinoTable(ident);
+      if (isIcebergTable(gravitinoTable)) {
+        return loadIcebergSparkTable(ident, getOrCreateIcebergGlueCatalog());
+      }
+      syncNamespaceToDerby(ident.namespace());

Review Comment:
   `Derby` is only used for testing, I'm curious about why do we add those 
logic in the code.



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

Reply via email to