jarredhj0214 commented on code in PR #13550:
URL: https://github.com/apache/gravitino/pull/13550#discussion_r4491011875


##########
catalogs/hive-metastore-common/src/main/java/org/apache/gravitino/hive/client/HiveShim.java:
##########
@@ -334,4 +369,121 @@ protected EnvironmentContext doNotUpdateStatsContext() {
     return new EnvironmentContext(
         Collections.singletonMap(StatsSetupConst.DO_NOT_UPDATE_STATS, 
StatsSetupConst.TRUE));
   }
+
+  /**
+   * Resolves storage schemas and converts a table without loading column 
constraints.
+   *
+   * @param catalogName The Hive catalog name.
+   * @param table The metastore table.
+   * @return The converted table, retaining its original derived schema for 
alters.
+   * @throws TException If the metastore cannot resolve the schema.
+   */
+  protected HiveTable convertTable(String catalogName, Table table) throws 
TException {
+    List<Column> original = resolveDerivedColumns(catalogName, table);
+    HiveTable converted = HiveTableConverter.fromHiveTable(table);
+    converted.setOriginalStorageColumns(original);
+    return converted;
+  }
+
+  /**
+   * Resolves only tables containing the SerDe-derived type marker.
+   *
+   * @param catalogName The Hive catalog name.
+   * @param table The metastore table to update in memory.
+   * @return A copy of the original storage columns, or an empty list for an 
ordinary table.
+   * @throws TException If the metastore cannot resolve the schema.
+   */
+  protected List<Column> resolveDerivedColumns(String catalogName, Table 
table) throws TException {
+    if (!hasDerivedColumnTypes(table)) {
+      return Collections.emptyList();
+    }
+    List<Column> original =
+        table.getSd().getCols().stream()
+            .<Column>map(
+                field ->
+                    Column.of(
+                        field.getName(),
+                        Types.UnparsedType.of(field.getType()),
+                        field.getComment()))
+            .toList();
+    try {
+      replaceDerivedColumns(table, getFields(catalogName, table.getDbName(), 
table.getTableName()));
+    } catch (MetaException e) {
+      MetaException failure = new MetaException(derivedSchemaError(table));

Review Comment:
   Fixed in 888968f31. SerDe failures are now classified before 
connection-keyword matching. Added Hive 2/3 coverage for both failure paths 
with network/connect table names; all 59 module tests pass.



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