Skip to content

Commit 9c237d7

Browse files
wangyumsrowen
authored andcommitted
[SPARK-43225][BUILD][SQL] Remove jackson-core-asl and jackson-mapper-asl from pre-built distribution
### What changes were proposed in this pull request? - Remove `jackson-core-asl` from maven dependency. - Change the scope of `jackson-mapper-asl` from compile to test. - Replace all `Hive.get(conf)` with `Hive.getWithoutRegisterFns(conf)`. ### Why are the changes needed? To fix CVE issue: https://github.com/apache/spark/security/dependabot/50. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? manual test. Closes apache#40893 from wangyum/SPARK-43225. Lead-authored-by: Yuming Wang <[email protected]> Co-authored-by: Yuming Wang <[email protected]> Signed-off-by: Sean Owen <[email protected]>
1 parent 516d7b3 commit 9c237d7

File tree

6 files changed

+7
-36
lines changed

6 files changed

+7
-36
lines changed

core/pom.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -505,14 +505,6 @@
505505
<groupId>commons-logging</groupId>
506506
<artifactId>commons-logging</artifactId>
507507
</exclusion>
508-
<exclusion>
509-
<groupId>org.codehaus.jackson</groupId>
510-
<artifactId>jackson-mapper-asl</artifactId>
511-
</exclusion>
512-
<exclusion>
513-
<groupId>org.codehaus.jackson</groupId>
514-
<artifactId>jackson-core-asl</artifactId>
515-
</exclusion>
516508
<exclusion>
517509
<groupId>com.fasterxml.jackson.core</groupId>
518510
<artifactId>jackson-core</artifactId>

dev/deps/spark-deps-hadoop-3-hive-2.3

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,11 @@ ini4j/0.5.4//ini4j-0.5.4.jar
9898
istack-commons-runtime/3.0.8//istack-commons-runtime-3.0.8.jar
9999
ivy/2.5.1//ivy-2.5.1.jar
100100
jackson-annotations/2.14.2//jackson-annotations-2.14.2.jar
101-
jackson-core-asl/1.9.13//jackson-core-asl-1.9.13.jar
102101
jackson-core/2.14.2//jackson-core-2.14.2.jar
103102
jackson-databind/2.14.2//jackson-databind-2.14.2.jar
104103
jackson-dataformat-cbor/2.14.2//jackson-dataformat-cbor-2.14.2.jar
105104
jackson-dataformat-yaml/2.14.2//jackson-dataformat-yaml-2.14.2.jar
106105
jackson-datatype-jsr310/2.14.2//jackson-datatype-jsr310-2.14.2.jar
107-
jackson-mapper-asl/1.9.13//jackson-mapper-asl-1.9.13.jar
108106
jackson-module-scala_2.12/2.14.2//jackson-module-scala_2.12-2.14.2.jar
109107
jakarta.annotation-api/1.3.5//jakarta.annotation-api-1.3.5.jar
110108
jakarta.inject/2.6.1//jakarta.inject-2.6.1.jar

pom.xml

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,10 +1314,6 @@
13141314
<groupId>asm</groupId>
13151315
<artifactId>asm</artifactId>
13161316
</exclusion>
1317-
<exclusion>
1318-
<groupId>org.codehaus.jackson</groupId>
1319-
<artifactId>jackson-mapper-asl</artifactId>
1320-
</exclusion>
13211317
<exclusion>
13221318
<groupId>org.ow2.asm</groupId>
13231319
<artifactId>asm</artifactId>
@@ -1818,27 +1814,12 @@
18181814
</exclusion>
18191815
</exclusions>
18201816
</dependency>
1821-
<dependency>
1822-
<groupId>org.codehaus.jackson</groupId>
1823-
<artifactId>jackson-core-asl</artifactId>
1824-
<version>${codehaus.jackson.version}</version>
1825-
<scope>${hadoop.deps.scope}</scope>
1826-
</dependency>
1817+
<!-- Hive 2.3 need this to init Hive's FunctionRegistry -->
18271818
<dependency>
18281819
<groupId>org.codehaus.jackson</groupId>
18291820
<artifactId>jackson-mapper-asl</artifactId>
18301821
<version>${codehaus.jackson.version}</version>
1831-
<scope>${hadoop.deps.scope}</scope>
1832-
</dependency>
1833-
<dependency>
1834-
<groupId>org.codehaus.jackson</groupId>
1835-
<artifactId>jackson-xc</artifactId>
1836-
<version>${codehaus.jackson.version}</version>
1837-
</dependency>
1838-
<dependency>
1839-
<groupId>org.codehaus.jackson</groupId>
1840-
<artifactId>jackson-jaxrs</artifactId>
1841-
<version>${codehaus.jackson.version}</version>
1822+
<scope>test</scope>
18421823
</dependency>
18431824
<dependency>
18441825
<groupId>${hive.group}</groupId>

sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ public synchronized String getDelegationTokenFromMetaStore(String owner)
536536

537537
try {
538538
Hive.closeCurrent();
539-
return Hive.get(hiveConf).getDelegationToken(owner, owner);
539+
return Hive.getWithoutRegisterFns(hiveConf).getDelegationToken(owner, owner);
540540
} catch (HiveException e) {
541541
if (e.getCause() instanceof UnsupportedOperationException) {
542542
throw (UnsupportedOperationException)e.getCause();

sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public static int setVariable(String varname, String varvalue) throws Exception
252252
ss.getHiveVariables().put(propName, substitution.substitute(ss.getConf(),varvalue));
253253
} else if (varname.startsWith(METACONF_PREFIX)) {
254254
String propName = varname.substring(METACONF_PREFIX.length());
255-
Hive hive = Hive.get(ss.getConf());
255+
Hive hive = Hive.getWithoutRegisterFns(ss.getConf());
256256
hive.setMetaConf(propName, substitution.substitute(ss.getConf(), varvalue));
257257
} else {
258258
setConf(varname, varname, varvalue, true);
@@ -413,7 +413,7 @@ public HiveConf getHiveConf() {
413413
@Override
414414
public IMetaStoreClient getMetaStoreClient() throws HiveSQLException {
415415
try {
416-
return Hive.get(getHiveConf()).getMSC();
416+
return Hive.getWithoutRegisterFns(getHiveConf()).getMSC();
417417
} catch (HiveException e) {
418418
throw new HiveSQLException("Failed to get metastore connection", e);
419419
} catch (MetaException e) {

sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public HiveSessionImplwithUGI(TProtocolVersion protocol, String username, String
5454
// create a new metastore connection for this particular user session
5555
Hive.set(null);
5656
try {
57-
sessionHive = Hive.get(getHiveConf());
57+
sessionHive = Hive.getWithoutRegisterFns(getHiveConf());
5858
} catch (HiveException e) {
5959
throw new HiveSQLException("Failed to setup metastore connection", e);
6060
}
@@ -140,7 +140,7 @@ private void setDelegationToken(String delegationTokenStr) throws HiveSQLExcepti
140140
private void cancelDelegationToken() throws HiveSQLException {
141141
if (delegationTokenStr != null) {
142142
try {
143-
Hive.get(getHiveConf()).cancelDelegationToken(delegationTokenStr);
143+
Hive.getWithoutRegisterFns(getHiveConf()).cancelDelegationToken(delegationTokenStr);
144144
} catch (HiveException e) {
145145
throw new HiveSQLException("Couldn't cancel delegation token", e);
146146
}

0 commit comments

Comments
 (0)