feat(hive): migrate agent to native Go

This commit is contained in:
t8y2
2026-08-11 23:13:04 +08:00
parent dd42bc9ac8
commit c68cb88bf9
91 changed files with 18227 additions and 22 deletions
+12 -2
View File
@@ -51,6 +51,7 @@ function fileContainsCommonDependency(path, moduleExists, readModuleFile) {
const nativeDriverDirectories = {
cassandra: "cassandra-go",
duckdb: "duckdb",
hive: "hive-go",
oracle: "oracle-go",
kingbase: "kingbase-go",
iotdb: "iotdb",
@@ -59,7 +60,14 @@ const nativeDriverDirectories = {
rabbitmq: "rabbitmq",
tdengine: "tdengine",
};
const nativeDriverModules = new Set(["cassandra", "duckdb", "oracle", "xugu", "kingbase", "iotdb", "neo4j", "vastbase", "rabbitmq", "tdengine"]);
const nativeDriverModules = new Set(["cassandra", "duckdb", "hive", "oracle", "xugu", "kingbase", "iotdb", "neo4j", "vastbase", "rabbitmq", "tdengine"]);
const nativeDriverSharedPaths = {
hive: [
"agents/go-common/go-gssapi",
"agents/go-common/gohive",
"agents/go-common/gosasl",
],
};
function resolveAgentModule(moduleName, { legacyStandaloneModules, moduleExists, readModuleFile }) {
let checkDir = null;
@@ -82,6 +90,7 @@ function resolveAgentModule(moduleName, { legacyStandaloneModules, moduleExists,
return {
checkDir,
modulePath,
sharedPaths: nativeDriverSharedPaths[moduleName] ?? [],
javaBuild: hasBuildGradle,
nativeBuild: nativeDriverModules.has(moduleName),
commonDependent: hasBuildGradle && (explicitlyDependsOnCommon || !legacyStandaloneModules.has(moduleName)),
@@ -137,7 +146,8 @@ export function evaluateAgentVersionBump({
}
for (const { moduleName, module } of resolvedModules) {
const moduleChanged = pathChanged(changedFiles, module.modulePath);
const moduleChanged = [module.modulePath, ...module.sharedPaths]
.some((path) => pathChanged(changedFiles, path));
// Only modules that package agents/common need installer-visible updates
// for shared Java runtime changes; native and standalone agents do not.
const commonAffectsModule = commonChanged && module.commonDependent;
@@ -83,6 +83,26 @@ test("bumps Cassandra from its native Go source directory", () => {
assert.deepEqual(result.nativeModules, ["cassandra"]);
});
test("bumps Hive from native and shared Kerberos source directories", () => {
for (const changedFile of [
"agents/drivers/hive-go/main.go",
"agents/go-common/gohive/driver.go",
"agents/go-common/gosasl/gssapi.go",
"agents/go-common/go-gssapi/krb5/krb5.go",
]) {
const result = evaluateAgentVersionBump({
versions: { hive: "0.1.43" },
changedFiles: [changedFile],
moduleExists: (path) => path === "agents/drivers/hive-go",
readModuleFile: () => "",
});
assert.equal(result.versions.hive, "0.1.44");
assert.deepEqual(result.javaModules, []);
assert.deepEqual(result.nativeModules, ["hive"]);
}
});
test("bumps Neo4j from its native Go source directory", () => {
const result = evaluateAgentVersionBump({
versions: { neo4j: "0.1.39" },