-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hive: Unwrap RuntimeException for Hive TException with rename table #9432
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
import org.apache.iceberg.common.DynMethods; | ||
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap; | ||
import org.apache.iceberg.relocated.com.google.common.collect.Maps; | ||
import org.apache.thrift.TException; | ||
|
||
public class MetastoreUtil { | ||
private static final DynMethods.UnboundMethod ALTER_TABLE = | ||
|
@@ -54,7 +55,7 @@ private MetastoreUtil() {} | |
* context will be set in a way that turns off stats updates to avoid recursive file listing. | ||
*/ | ||
public static void alterTable( | ||
IMetaStoreClient client, String databaseName, String tblName, Table table) { | ||
IMetaStoreClient client, String databaseName, String tblName, Table table) throws TException { | ||
alterTable(client, databaseName, tblName, table, ImmutableMap.of()); | ||
} | ||
|
||
|
@@ -67,11 +68,21 @@ public static void alterTable( | |
String databaseName, | ||
String tblName, | ||
Table table, | ||
Map<String, String> extraEnv) { | ||
Map<String, String> extraEnv) | ||
throws TException { | ||
Map<String, String> env = Maps.newHashMapWithExpectedSize(extraEnv.size() + 1); | ||
env.putAll(extraEnv); | ||
env.put(StatsSetupConst.DO_NOT_UPDATE_STATS, StatsSetupConst.TRUE); | ||
|
||
ALTER_TABLE.invoke(client, databaseName, tblName, table, new EnvironmentContext(env)); | ||
try { | ||
ALTER_TABLE.invoke(client, databaseName, tblName, table, new EnvironmentContext(env)); | ||
} catch (RuntimeException e) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How widely is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's only being used at two places: Are you proposing to throw non RTE
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I proposing something like this:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any thoughts on the test case testRenameTableDestinationTableAlreadyExists since it expects error message as
Currently we have override this as
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We should only consider moving the exception if we find that all of the places where we call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Or Am I missing something here ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not unwrap RTE with both
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made a mistake in the above command, I thought, that the root exception is So fixing this issue, my comment correctly is below: The |
||
// TException would be wrapped into RuntimeException during reflection | ||
if (e.getCause() instanceof TException) { | ||
throw (TException) e.getCause(); | ||
} else { | ||
throw e; | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we please move this under a
catch (InvalidOperationException)
?But keep the old
TException
handler part