Skip to content

Commit e305e22

Browse files
committed
HIVE-29403: Move the truncate table out of HMSHandler
1 parent 6484ad3 commit e305e22

File tree

12 files changed

+503
-356
lines changed

12 files changed

+503
-356
lines changed

standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/JavaUtils.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,18 @@ public static <T> void setField(T req, String methodName, Class[] argsCls, Objec
128128
}
129129
}
130130

131+
public static <T> T getField(Object payload, String methodName) {
132+
try {
133+
Method method = payload.getClass().getDeclaredMethod(methodName);
134+
method.setAccessible(true);
135+
return (T) method.invoke(payload);
136+
} catch (Exception e) {
137+
LOG.error("Unable to invoke the method: {} of the instance: {}, message: {}",
138+
methodName, payload, e.getMessage());
139+
throw new RuntimeException(e);
140+
}
141+
}
142+
131143
/**
132144
* Utility method for ACID to normalize logging info. Matches
133145
* org.apache.hadoop.hive.metastore.api.LockRequest#toString

standalone-metastore/metastore-server/pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<name>Hive Metastore Server</name>
2424
<properties>
2525
<standalone.metastore.path.to.root>..</standalone.metastore.path.to.root>
26+
<reflections.version>0.10.2</reflections.version>
2627
</properties>
2728
<dependencies>
2829
<dependency>
@@ -70,6 +71,17 @@
7071
</exclusion>
7172
</exclusions>
7273
</dependency>
74+
<dependency>
75+
<groupId>org.reflections</groupId>
76+
<artifactId>reflections</artifactId>
77+
<version>${reflections.version}</version>
78+
<exclusions>
79+
<exclusion>
80+
<groupId>com.google.code.findbugs</groupId>
81+
<artifactId>annotations</artifactId>
82+
</exclusion>
83+
</exclusions>
84+
</dependency>
7385
<dependency>
7486
<groupId>com.fasterxml.jackson.core</groupId>
7587
<artifactId>jackson-databind</artifactId>

standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java

Lines changed: 20 additions & 225 deletions
Large diffs are not rendered by default.

standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@
6868
import java.util.LinkedList;
6969
import java.util.Optional;
7070

71-
import static org.apache.hadoop.hive.metastore.HMSHandler.addTruncateBaseFile;
7271
import static org.apache.hadoop.hive.metastore.HiveMetaHook.ALTERLOCATION;
7372
import static org.apache.hadoop.hive.metastore.HiveMetaHook.ALTER_TABLE_OPERATION_TYPE;
7473
import static org.apache.hadoop.hive.metastore.HiveMetaStoreClient.RENAME_PARTITION_MAKE_COPY;
74+
import static org.apache.hadoop.hive.metastore.handler.TruncateTableHandler.addTruncateBaseFile;
7575
import static org.apache.hadoop.hive.metastore.utils.MetaStoreServerUtils.findStaleColumns;
7676
import static org.apache.hadoop.hive.metastore.utils.MetaStoreServerUtils.isDbReplicationTarget;
7777
import static org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.getDefaultCatalog;

0 commit comments

Comments
 (0)