Skip to content

Commit 919028c

Browse files
iemejiarshkv
authored andcommitted
[SPARK-27733][CORE] Upgrade Avro to version 1.10.1
Update Avro dependency to version 1.10.1 To catch up multiple improvements of Avro as well as fix security issues on transitive dependencies. No Since there were no API changes required we just run the tests Closes apache#31232 from iemejia/SPARK-27733-avro-upgrade. Authored-by: Ismaël Mejía <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 94c1140 commit 919028c

File tree

14 files changed

+36
-77
lines changed

14 files changed

+36
-77
lines changed

core/pom.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,13 @@
3535
</properties>
3636

3737
<dependencies>
38-
<dependency>
39-
<groupId>com.thoughtworks.paranamer</groupId>
40-
<artifactId>paranamer</artifactId>
41-
</dependency>
4238
<dependency>
4339
<groupId>org.apache.avro</groupId>
4440
<artifactId>avro</artifactId>
4541
</dependency>
4642
<dependency>
4743
<groupId>org.apache.avro</groupId>
4844
<artifactId>avro-mapred</artifactId>
49-
<classifier>${avro.mapred.classifier}</classifier>
5045
</dependency>
5146
<dependency>
5247
<groupId>com.google.guava</groupId>
@@ -165,6 +160,10 @@
165160
<artifactId>javax.servlet-api</artifactId>
166161
<version>${javaxservlet.version}</version>
167162
</dependency>
163+
<dependency>
164+
<groupId>commons-codec</groupId>
165+
<artifactId>commons-codec</artifactId>
166+
</dependency>
168167
<dependency>
169168
<groupId>org.apache.commons</groupId>
170169
<artifactId>commons-lang3</artifactId>

core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeInMemorySorter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import java.util.Comparator;
2121
import java.util.LinkedList;
2222

23-
import org.apache.avro.reflect.Nullable;
23+
import javax.annotation.Nullable;
2424

2525
import org.apache.spark.TaskContext;
2626
import org.apache.spark.memory.MemoryConsumer;

dev/deps/spark-deps-hadoop-palantir

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ arrow-format/0.15.1//arrow-format-0.15.1.jar
1616
arrow-memory/0.15.1//arrow-memory-0.15.1.jar
1717
arrow-vector/0.15.1//arrow-vector-0.15.1.jar
1818
audience-annotations/0.5.0//audience-annotations-0.5.0.jar
19-
avro-ipc/1.8.2//avro-ipc-1.8.2.jar
20-
avro-mapred/1.8.2/hadoop2/avro-mapred-1.8.2-hadoop2.jar
21-
avro/1.8.2//avro-1.8.2.jar
19+
avro-ipc/1.10.1//avro-ipc-1.10.1.jar
20+
avro-mapred/1.10.1//avro-mapred-1.10.1.jar
21+
avro/1.10.1//avro-1.10.1.jar
2222
breeze-macros_2.12/1.0//breeze-macros_2.12-1.0.jar
2323
breeze_2.12/1.0//breeze_2.12-1.0.jar
2424
cats-kernel_2.12/2.0.0-M4//cats-kernel_2.12-2.0.0-M4.jar
@@ -80,7 +80,6 @@ jackson-core/2.12.1//jackson-core-2.12.1.jar
8080
jackson-databind/2.12.1//jackson-databind-2.12.1.jar
8181
jackson-dataformat-yaml/2.12.1//jackson-dataformat-yaml-2.12.1.jar
8282
jackson-jaxrs/1.9.13//jackson-jaxrs-1.9.13.jar
83-
jackson-mapper-asl/1.9.13//jackson-mapper-asl-1.9.13.jar
8483
jackson-module-scala_2.12/2.12.1//jackson-module-scala_2.12-2.12.1.jar
8584
jackson-xc/1.9.13//jackson-xc-1.9.13.jar
8685
jakarta.annotation-api/1.3.5//jakarta.annotation-api-1.3.5.jar
@@ -172,6 +171,6 @@ univocity-parsers/2.9.0//univocity-parsers-2.9.0.jar
172171
woodstox-core/5.0.3//woodstox-core-5.0.3.jar
173172
xbean-asm7-shaded/4.15//xbean-asm7-shaded-4.15.jar
174173
xmlenc/0.52//xmlenc-0.52.jar
175-
xz/1.5//xz-1.5.jar
174+
xz/1.8//xz-1.8.jar
176175
zookeeper/3.4.14//zookeeper-3.4.14.jar
177176
zstd-jni/1.4.4-3//zstd-jni-1.4.4-3.jar

docs/sql-data-sources-avro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ applications. Read the [Advanced Dependency Management](https://spark.apache
309309
Submission Guide for more details.
310310

311311
## Supported types for Avro -> Spark SQL conversion
312-
Currently Spark supports reading all [primitive types](https://avro.apache.org/docs/1.8.2/spec.html#schema_primitive) and [complex types](https://avro.apache.org/docs/1.8.2/spec.html#schema_complex) under records of Avro.
312+
Currently Spark supports reading all [primitive types](https://avro.apache.org/docs/1.10.1/spec.html#schema_primitive) and [complex types](https://avro.apache.org/docs/1.10.1/spec.html#schema_complex) under records of Avro.
313313
<table class="table">
314314
<tr><th><b>Avro type</b></th><th><b>Spark SQL type</b></th></tr>
315315
<tr>
@@ -373,7 +373,7 @@ In addition to the types listed above, it supports reading `union` types. The fo
373373
3. `union(something, null)`, where something is any supported Avro type. This will be mapped to the same Spark SQL type as that of something, with nullable set to true.
374374
All other union types are considered complex. They will be mapped to StructType where field names are member0, member1, etc., in accordance with members of the union. This is consistent with the behavior when converting between Avro and Parquet.
375375

376-
It also supports reading the following Avro [logical types](https://avro.apache.org/docs/1.8.2/spec.html#Logical+Types):
376+
It also supports reading the following Avro [logical types](https://avro.apache.org/docs/1.10.1/spec.html#Logical+Types):
377377

378378
<table class="table">
379379
<tr><th><b>Avro logical type</b></th><th><b>Avro type</b></th><th><b>Spark SQL type</b></th></tr>

external/avro/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@
7070
<groupId>org.apache.spark</groupId>
7171
<artifactId>spark-tags_${scala.binary.version}</artifactId>
7272
</dependency>
73+
<dependency>
74+
<groupId>org.tukaani</groupId>
75+
<artifactId>xz</artifactId>
76+
</dependency>
7377
</dependencies>
7478
<build>
7579
<outputDirectory>target/scala-${scala.binary.version}/classes</outputDirectory>

external/avro/src/main/scala/org/apache/spark/sql/avro/AvroOptions.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ private[sql] class AvroOptions(
5151

5252
/**
5353
* Top level record name in write result, which is required in Avro spec.
54-
* See https://avro.apache.org/docs/1.8.2/spec.html#schema_record .
54+
* See https://avro.apache.org/docs/1.10.1/spec.html#schema_record .
5555
* Default value is "topLevelRecord"
5656
*/
5757
val recordName: String = parameters.getOrElse("recordName", "topLevelRecord")
5858

5959
/**
6060
* Record namespace in write result. Default value is "".
61-
* See Avro spec for details: https://avro.apache.org/docs/1.8.2/spec.html#schema_record .
61+
* See Avro spec for details: https://avro.apache.org/docs/1.10.1/spec.html#schema_record .
6262
*/
6363
val recordNamespace: String = parameters.getOrElse("recordNamespace", "")
6464

external/avro/src/test/scala/org/apache/spark/sql/avro/AvroSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ abstract class AvroSuite extends QueryTest with SharedSparkSession {
10101010
.save(s"$tempDir/${UUID.randomUUID()}")
10111011
}.getCause.getMessage
10121012
assert(message.contains("Caused by: java.lang.NullPointerException: " +
1013-
"in test_schema in string null of string in field Name"))
1013+
"null of string in string in field Name of test_schema in test_schema"))
10141014
}
10151015
}
10161016

external/kafka-0-10-assembly/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
<dependency>
7878
<groupId>org.apache.avro</groupId>
7979
<artifactId>avro-mapred</artifactId>
80-
<classifier>${avro.mapred.classifier}</classifier>
8180
<scope>provided</scope>
8281
</dependency>
8382
<dependency>

external/kinesis-asl-assembly/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,9 @@
9494
<artifactId>hadoop-client</artifactId>
9595
<scope>provided</scope>
9696
</dependency>
97-
<dependency>
98-
<groupId>org.apache.avro</groupId>
99-
<artifactId>avro-ipc</artifactId>
100-
<scope>provided</scope>
101-
</dependency>
10297
<dependency>
10398
<groupId>org.apache.avro</groupId>
10499
<artifactId>avro-mapred</artifactId>
105-
<classifier>${avro.mapred.classifier}</classifier>
106100
<scope>provided</scope>
107101
</dependency>
108102
<dependency>

pom.xml

Lines changed: 15 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@
155155
the link to metrics.dropwizard.io in docs/monitoring.md.
156156
-->
157157
<codahale.metrics.version>4.1.1</codahale.metrics.version>
158-
<avro.version>1.8.2</avro.version>
159-
<avro.mapred.classifier>hadoop2</avro.mapred.classifier>
158+
<avro.version>1.10.1</avro.version>
160159
<aws.kinesis.client.version>1.12.0</aws.kinesis.client.version>
161160
<!-- Should be consistent with Kinesis client dependency -->
162161
<aws.java.sdk.version>1.11.655</aws.java.sdk.version>
@@ -201,10 +200,6 @@
201200
<jpam.version>1.1</jpam.version>
202201
<selenium.version>2.52.0</selenium.version>
203202
<htmlunit.version>2.22</htmlunit.version>
204-
<!--
205-
Managed up from older version from Avro; sync with jackson-module-paranamer dependency version
206-
-->
207-
<paranamer.version>2.8</paranamer.version>
208203
<maven-antrun.version>1.8</maven-antrun.version>
209204
<commons-crypto.version>1.1.0</commons-crypto.version>
210205
<!--
@@ -1183,48 +1178,16 @@
11831178
<artifactId>avro</artifactId>
11841179
<version>${avro.version}</version>
11851180
</dependency>
1186-
<dependency>
1187-
<groupId>org.apache.avro</groupId>
1188-
<artifactId>avro-ipc</artifactId>
1189-
<version>${avro.version}</version>
1190-
<exclusions>
1191-
<exclusion>
1192-
<groupId>io.netty</groupId>
1193-
<artifactId>netty</artifactId>
1194-
</exclusion>
1195-
<exclusion>
1196-
<groupId>org.mortbay.jetty</groupId>
1197-
<artifactId>jetty</artifactId>
1198-
</exclusion>
1199-
<exclusion>
1200-
<groupId>org.mortbay.jetty</groupId>
1201-
<artifactId>jetty-util</artifactId>
1202-
</exclusion>
1203-
<exclusion>
1204-
<groupId>org.mortbay.jetty</groupId>
1205-
<artifactId>servlet-api</artifactId>
1206-
</exclusion>
1207-
<exclusion>
1208-
<groupId>org.apache.velocity</groupId>
1209-
<artifactId>velocity</artifactId>
1210-
</exclusion>
1211-
</exclusions>
1212-
</dependency>
1213-
<!-- avro-mapred for some reason depends on avro-ipc's test jar, so undo that. -->
1214-
<dependency>
1215-
<groupId>org.apache.avro</groupId>
1216-
<artifactId>avro-ipc</artifactId>
1217-
<classifier>tests</classifier>
1218-
<version>${avro.version}</version>
1219-
<scope>test</scope>
1220-
</dependency>
12211181
<dependency>
12221182
<groupId>org.apache.avro</groupId>
12231183
<artifactId>avro-mapred</artifactId>
12241184
<version>${avro.version}</version>
1225-
<classifier>${avro.mapred.classifier}</classifier>
12261185
<scope>${hive.deps.scope}</scope>
12271186
<exclusions>
1187+
<exclusion>
1188+
<groupId>org.apache.avro</groupId>
1189+
<artifactId>avro-ipc-jetty</artifactId>
1190+
</exclusion>
12281191
<exclusion>
12291192
<groupId>io.netty</groupId>
12301193
<artifactId>netty</artifactId>
@@ -1243,10 +1206,19 @@
12431206
</exclusion>
12441207
<exclusion>
12451208
<groupId>org.apache.velocity</groupId>
1246-
<artifactId>velocity</artifactId>
1209+
<artifactId>velocity-engine-core</artifactId>
1210+
</exclusion>
1211+
<exclusion>
1212+
<groupId>javax.annotation</groupId>
1213+
<artifactId>javax.annotation-api</artifactId>
12471214
</exclusion>
12481215
</exclusions>
12491216
</dependency>
1217+
<dependency>
1218+
<groupId>org.tukaani</groupId>
1219+
<artifactId>xz</artifactId>
1220+
<version>1.8</version>
1221+
</dependency>
12501222
<!-- See SPARK-23654 for info on this dependency;
12511223
It is used to keep javax.activation at v1.1.1 after dropping
12521224
jets3t as a dependency.
@@ -2343,12 +2315,6 @@
23432315
</exclusion>
23442316
</exclusions>
23452317
</dependency>
2346-
<dependency>
2347-
<groupId>com.thoughtworks.paranamer</groupId>
2348-
<artifactId>paranamer</artifactId>
2349-
<version>${paranamer.version}</version>
2350-
<scope>runtime</scope>
2351-
</dependency>
23522318
<dependency>
23532319
<groupId>org.apache.arrow</groupId>
23542320
<artifactId>arrow-vector</artifactId>

0 commit comments

Comments
 (0)