rdblue commented on a change in pull request #841: Upgrade Hive to 2.3.6 for Iceberg URL: https://github.com/apache/incubator-iceberg/pull/841#discussion_r392333011
########## File path: hive/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java ########## @@ -83,6 +86,18 @@ protected HiveTableOperations(Configuration conf, HiveClientPool metaClients, St this.tableName = table; this.lockAcquireTimeout = conf.getLong(HIVE_ACQUIRE_LOCK_STATE_TIMEOUT_MS, HIVE_ACQUIRE_LOCK_STATE_TIMEOUT_MS_DEFAULT); + try { + this.alterTableMethod = HiveMetaStoreClient.class.getMethod("alter_table_with_environmentContext", + String.class, String.class, Table.class, EnvironmentContext.class); + } catch (NoSuchMethodException e) { + try { + this.alterTableMethod = HiveMetaStoreClient.class.getMethod("alter_table", + String.class, String.class, Table.class, EnvironmentContext.class); + } catch (NoSuchMethodException inner) { + throw new RuntimeMetaException(inner, "Fail to find method alter_table_with_environmentContext and " + + "alter_table with right signature"); + } Review comment: Can you update this to use the reflection utilities from `iceberg-common`? Those handle exceptions and use a builder pattern so it's concise and easy to maintain across versions: ```java private static final DynMethods.UnboundMethod ALTER_TABLE = DynMethods .builder("alter_table") .impl(HiveMetaStoreClient.class, "alter_table_with_environmentContext", String.class, String.class, Table.class, EnvironmentContext.class) .impl(HiveMetaStoreClient.class, "alter_table", String.class, String.class, Table.class, EnvironmentContext.class) .build(); ``` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org