mirror of
https://github.com/apache/impala.git
synced 2026-02-03 09:00:39 -05:00
Like IMPALA-10871, this patch adds MetastoreShim to support Apache Hive 2.x. At the build time, based on the environment variable IMPALA_HIVE_DIST_TYPE one of the three shims is added to as source using the fe/pom.xml build plugin. And select the dependencies related to Hive in the fe/pom.xml based on the environment variable IMPALA_HIVE_MAJOR_VERSION. There are some duplicate classes under compat-apache-hive2 directory, e.g. fe/src/compat-apache-hive-2/java/ org/apache/impala/catalog/events/MetastoreEvents.java duplicates fe/src/main/java/org/apache/impala/catalog/events/MetastoreEvents.java The class in compat-apache-hive2 is a simplified version that works with Apache Hive 2.x. So we don't need to extract lots of Hive-dependent codes in MetastoreEvents.java into the metastore shim. Due to this, the build process simply remove the original source code when building on Apache Hive 2. Additionally, it should be noted that all the code in the fe/src/compat-apache-hive-2/java/org/apache/hadoop/hive directory comes from Apache Hive 3.x, original source: https://github.com/apache/hive/blob/branch-3.1 In order to reduce the unnecessary intrusion into the code, skip all tests when building with Apache Hive 2.x. If wanting to build Impala adapted to Apache Hive 2.x, please set the following environment variables before `source bin/impala-config.sh`: export USE_APACHE_COMPONENTS=true export USE_APACHE_HIVE_2=true TODO: - IMPALA-14581: Support testing related to Apache Hive 2 in the minicluster. Testing: - Compile using the -package option to obtain the package. After deployment, perform all types of query tests, including SELECT, INSERT, CREATE TABLE, ALTER TABLE, COMPUTE STATUS, etc. In addition, comprehensive testing has been conducted on the metadata auto-synchronization functionality. The tests confirm that all event types are supported except for AlterDatabaseEvent, AllocWriteIdEvent, AbortTxnEvent, PseudoAbortTxnEvent, and CommitCompactionEvent. It is worth noting that these unsupported events are not generated in Apache Hive 2, so their lack of processing support does not impact the functionality. Change-Id: Ib5f104dc8d131835b8118b9d54077471db65681c Reviewed-on: http://gerrit.cloudera.org:8080/21760 Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
307 lines
12 KiB
Diff
307 lines
12 KiB
Diff
From 92a3a88870623dad3b8fa1e02d5e855ae55dfcff Mon Sep 17 00:00:00 2001
|
|
From: ttttttz <2433038802@qq.com>
|
|
Date: Mon, 7 Jul 2025 01:56:58 +0800
|
|
Subject: [PATCH] Add the field catName to the NotificationEvent
|
|
|
|
---
|
|
metastore/if/hive_metastore.thrift | 1 +
|
|
.../hive/metastore/api/NotificationEvent.java | 116 +++++++++++++++++-
|
|
2 files changed, 112 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/metastore/if/hive_metastore.thrift b/metastore/if/hive_metastore.thrift
|
|
index 8a66bbcc70..bf33ae1954 100755
|
|
--- a/metastore/if/hive_metastore.thrift
|
|
+++ b/metastore/if/hive_metastore.thrift
|
|
@@ -820,6 +820,7 @@ struct NotificationEvent {
|
|
5: optional string tableName,
|
|
6: required string message,
|
|
7: optional string messageFormat,
|
|
+ 8: optional string catName,
|
|
}
|
|
|
|
struct NotificationEventResponse {
|
|
diff --git a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/NotificationEvent.java b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/NotificationEvent.java
|
|
index 8e0fb40bcc..e0e1cd4dc5 100644
|
|
--- a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/NotificationEvent.java
|
|
+++ b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/NotificationEvent.java
|
|
@@ -35,7 +35,7 @@
|
|
|
|
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
|
|
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
|
|
-public class NotificationEvent implements org.apache.thrift.TBase<NotificationEvent, NotificationEvent._Fields>, java.io.Serializable, Cloneable, Comparable<NotificationEvent> {
|
|
+@org.apache.hadoop.classification.InterfaceAudience.Public @org.apache.hadoop.classification.InterfaceStability.Stable public class NotificationEvent implements org.apache.thrift.TBase<NotificationEvent, NotificationEvent._Fields>, java.io.Serializable, Cloneable, Comparable<NotificationEvent> {
|
|
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("NotificationEvent");
|
|
|
|
private static final org.apache.thrift.protocol.TField EVENT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("eventId", org.apache.thrift.protocol.TType.I64, (short)1);
|
|
@@ -45,6 +45,7 @@
|
|
private static final org.apache.thrift.protocol.TField TABLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tableName", org.apache.thrift.protocol.TType.STRING, (short)5);
|
|
private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)6);
|
|
private static final org.apache.thrift.protocol.TField MESSAGE_FORMAT_FIELD_DESC = new org.apache.thrift.protocol.TField("messageFormat", org.apache.thrift.protocol.TType.STRING, (short)7);
|
|
+ private static final org.apache.thrift.protocol.TField CAT_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("catName", org.apache.thrift.protocol.TType.STRING, (short)8);
|
|
|
|
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
|
|
static {
|
|
@@ -59,6 +60,7 @@
|
|
private String tableName; // optional
|
|
private String message; // required
|
|
private String messageFormat; // optional
|
|
+ private String catName; // optional
|
|
|
|
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
|
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
|
@@ -68,7 +70,8 @@
|
|
DB_NAME((short)4, "dbName"),
|
|
TABLE_NAME((short)5, "tableName"),
|
|
MESSAGE((short)6, "message"),
|
|
- MESSAGE_FORMAT((short)7, "messageFormat");
|
|
+ MESSAGE_FORMAT((short)7, "messageFormat"),
|
|
+ CAT_NAME((short)8, "catName");
|
|
|
|
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
|
|
|
@@ -97,6 +100,8 @@ public static _Fields findByThriftId(int fieldId) {
|
|
return MESSAGE;
|
|
case 7: // MESSAGE_FORMAT
|
|
return MESSAGE_FORMAT;
|
|
+ case 8: // CAT_NAME
|
|
+ return CAT_NAME;
|
|
default:
|
|
return null;
|
|
}
|
|
@@ -140,7 +145,7 @@ public String getFieldName() {
|
|
private static final int __EVENTID_ISSET_ID = 0;
|
|
private static final int __EVENTTIME_ISSET_ID = 1;
|
|
private byte __isset_bitfield = 0;
|
|
- private static final _Fields optionals[] = {_Fields.DB_NAME,_Fields.TABLE_NAME,_Fields.MESSAGE_FORMAT};
|
|
+ private static final _Fields optionals[] = {_Fields.DB_NAME,_Fields.TABLE_NAME,_Fields.MESSAGE_FORMAT,_Fields.CAT_NAME};
|
|
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
|
|
static {
|
|
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
|
|
@@ -158,6 +163,8 @@ public String getFieldName() {
|
|
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
|
|
tmpMap.put(_Fields.MESSAGE_FORMAT, new org.apache.thrift.meta_data.FieldMetaData("messageFormat", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
|
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
|
|
+ tmpMap.put(_Fields.CAT_NAME, new org.apache.thrift.meta_data.FieldMetaData("catName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
|
|
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
|
|
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
|
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(NotificationEvent.class, metaDataMap);
|
|
}
|
|
@@ -202,6 +209,9 @@ public NotificationEvent(NotificationEvent other) {
|
|
if (other.isSetMessageFormat()) {
|
|
this.messageFormat = other.messageFormat;
|
|
}
|
|
+ if (other.isSetCatName()) {
|
|
+ this.catName = other.catName;
|
|
+ }
|
|
}
|
|
|
|
public NotificationEvent deepCopy() {
|
|
@@ -219,6 +229,7 @@ public void clear() {
|
|
this.tableName = null;
|
|
this.message = null;
|
|
this.messageFormat = null;
|
|
+ this.catName = null;
|
|
}
|
|
|
|
public long getEventId() {
|
|
@@ -380,6 +391,29 @@ public void setMessageFormatIsSet(boolean value) {
|
|
}
|
|
}
|
|
|
|
+ public String getCatName() {
|
|
+ return this.catName;
|
|
+ }
|
|
+
|
|
+ public void setCatName(String catName) {
|
|
+ this.catName = catName;
|
|
+ }
|
|
+
|
|
+ public void unsetCatName() {
|
|
+ this.catName = null;
|
|
+ }
|
|
+
|
|
+ /** Returns true if field catName is set (has been assigned a value) and false otherwise */
|
|
+ public boolean isSetCatName() {
|
|
+ return this.catName != null;
|
|
+ }
|
|
+
|
|
+ public void setCatNameIsSet(boolean value) {
|
|
+ if (!value) {
|
|
+ this.catName = null;
|
|
+ }
|
|
+ }
|
|
+
|
|
public void setFieldValue(_Fields field, Object value) {
|
|
switch (field) {
|
|
case EVENT_ID:
|
|
@@ -438,6 +472,14 @@ public void setFieldValue(_Fields field, Object value) {
|
|
}
|
|
break;
|
|
|
|
+ case CAT_NAME:
|
|
+ if (value == null) {
|
|
+ unsetCatName();
|
|
+ } else {
|
|
+ setCatName((String)value);
|
|
+ }
|
|
+ break;
|
|
+
|
|
}
|
|
}
|
|
|
|
@@ -464,6 +506,9 @@ public Object getFieldValue(_Fields field) {
|
|
case MESSAGE_FORMAT:
|
|
return getMessageFormat();
|
|
|
|
+ case CAT_NAME:
|
|
+ return getCatName();
|
|
+
|
|
}
|
|
throw new IllegalStateException();
|
|
}
|
|
@@ -489,6 +534,8 @@ public boolean isSet(_Fields field) {
|
|
return isSetMessage();
|
|
case MESSAGE_FORMAT:
|
|
return isSetMessageFormat();
|
|
+ case CAT_NAME:
|
|
+ return isSetCatName();
|
|
}
|
|
throw new IllegalStateException();
|
|
}
|
|
@@ -569,6 +616,15 @@ public boolean equals(NotificationEvent that) {
|
|
return false;
|
|
}
|
|
|
|
+ boolean this_present_catName = true && this.isSetCatName();
|
|
+ boolean that_present_catName = true && that.isSetCatName();
|
|
+ if (this_present_catName || that_present_catName) {
|
|
+ if (!(this_present_catName && that_present_catName))
|
|
+ return false;
|
|
+ if (!this.catName.equals(that.catName))
|
|
+ return false;
|
|
+ }
|
|
+
|
|
return true;
|
|
}
|
|
|
|
@@ -611,6 +667,11 @@ public int hashCode() {
|
|
if (present_messageFormat)
|
|
list.add(messageFormat);
|
|
|
|
+ boolean present_catName = true && (isSetCatName());
|
|
+ list.add(present_catName);
|
|
+ if (present_catName)
|
|
+ list.add(catName);
|
|
+
|
|
return list.hashCode();
|
|
}
|
|
|
|
@@ -692,6 +753,16 @@ public int compareTo(NotificationEvent other) {
|
|
return lastComparison;
|
|
}
|
|
}
|
|
+ lastComparison = Boolean.valueOf(isSetCatName()).compareTo(other.isSetCatName());
|
|
+ if (lastComparison != 0) {
|
|
+ return lastComparison;
|
|
+ }
|
|
+ if (isSetCatName()) {
|
|
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.catName, other.catName);
|
|
+ if (lastComparison != 0) {
|
|
+ return lastComparison;
|
|
+ }
|
|
+ }
|
|
return 0;
|
|
}
|
|
|
|
@@ -765,6 +836,16 @@ public String toString() {
|
|
}
|
|
first = false;
|
|
}
|
|
+ if (isSetCatName()) {
|
|
+ if (!first) sb.append(", ");
|
|
+ sb.append("catName:");
|
|
+ if (this.catName == null) {
|
|
+ sb.append("null");
|
|
+ } else {
|
|
+ sb.append(this.catName);
|
|
+ }
|
|
+ first = false;
|
|
+ }
|
|
sb.append(")");
|
|
return sb.toString();
|
|
}
|
|
@@ -882,6 +963,14 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, NotificationEvent s
|
|
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
|
}
|
|
break;
|
|
+ case 8: // CAT_NAME
|
|
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
|
|
+ struct.catName = iprot.readString();
|
|
+ struct.setCatNameIsSet(true);
|
|
+ } else {
|
|
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
|
+ }
|
|
+ break;
|
|
default:
|
|
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
|
}
|
|
@@ -932,6 +1021,13 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, NotificationEvent
|
|
oprot.writeFieldEnd();
|
|
}
|
|
}
|
|
+ if (struct.catName != null) {
|
|
+ if (struct.isSetCatName()) {
|
|
+ oprot.writeFieldBegin(CAT_NAME_FIELD_DESC);
|
|
+ oprot.writeString(struct.catName);
|
|
+ oprot.writeFieldEnd();
|
|
+ }
|
|
+ }
|
|
oprot.writeFieldStop();
|
|
oprot.writeStructEnd();
|
|
}
|
|
@@ -963,7 +1059,10 @@ public void write(org.apache.thrift.protocol.TProtocol prot, NotificationEvent s
|
|
if (struct.isSetMessageFormat()) {
|
|
optionals.set(2);
|
|
}
|
|
- oprot.writeBitSet(optionals, 3);
|
|
+ if (struct.isSetCatName()) {
|
|
+ optionals.set(3);
|
|
+ }
|
|
+ oprot.writeBitSet(optionals, 4);
|
|
if (struct.isSetDbName()) {
|
|
oprot.writeString(struct.dbName);
|
|
}
|
|
@@ -973,6 +1072,9 @@ public void write(org.apache.thrift.protocol.TProtocol prot, NotificationEvent s
|
|
if (struct.isSetMessageFormat()) {
|
|
oprot.writeString(struct.messageFormat);
|
|
}
|
|
+ if (struct.isSetCatName()) {
|
|
+ oprot.writeString(struct.catName);
|
|
+ }
|
|
}
|
|
|
|
@Override
|
|
@@ -986,7 +1088,7 @@ public void read(org.apache.thrift.protocol.TProtocol prot, NotificationEvent st
|
|
struct.setEventTypeIsSet(true);
|
|
struct.message = iprot.readString();
|
|
struct.setMessageIsSet(true);
|
|
- BitSet incoming = iprot.readBitSet(3);
|
|
+ BitSet incoming = iprot.readBitSet(4);
|
|
if (incoming.get(0)) {
|
|
struct.dbName = iprot.readString();
|
|
struct.setDbNameIsSet(true);
|
|
@@ -999,6 +1101,10 @@ public void read(org.apache.thrift.protocol.TProtocol prot, NotificationEvent st
|
|
struct.messageFormat = iprot.readString();
|
|
struct.setMessageFormatIsSet(true);
|
|
}
|
|
+ if (incoming.get(3)) {
|
|
+ struct.catName = iprot.readString();
|
|
+ struct.setCatNameIsSet(true);
|
|
+ }
|
|
}
|
|
}
|
|
|
|
--
|
|
2.32.1 (Apple Git-133)
|
|
|