Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
b4b48e3
Preparing development version 4.2.1-SNAPSHOT
Jun 12, 2026
8f9da70
[SPARK-57434][SQL][TEST] Move JavaGeographyTypeSuite and JavaGeometry…
cloud-fan Jun 14, 2026
87f9c71
[SPARK-56395][SQL][FOLLOWUP] Fix RewriteNearestByJoin nullability for…
cloud-fan Jun 15, 2026
79db6cd
[SPARK-57482][CORE][TEST] Fix flaky SparkLauncherSuite.testInProcessL…
dbtsai Jun 16, 2026
68ae6b1
[SPARK-57429][SQL] Revise debug message in `ThriftHttpServlet`
dongjoon-hyun Jun 14, 2026
04ca5e6
[SPARK-57430][CORE] Validate length before allocation in `Encoders.By…
dongjoon-hyun Jun 14, 2026
b7ba53c
[SPARK-57426][CORE] Validate length before allocation in `Encoders.St…
dongjoon-hyun Jun 13, 2026
77b3f64
[SPARK-57439][CORE] Validate length before allocation in `Encoders.(I…
dongjoon-hyun Jun 14, 2026
bf50ad9
[SPARK-57446][SQL] Apply `escapeSql` to `comment` in JDBC `table/sche…
dongjoon-hyun Jun 15, 2026
85a0972
[SPARK-57447][SQL] Escape the index name in `(H2|MySQL|Postgres)Diale…
dongjoon-hyun Jun 15, 2026
a6480c1
[SPARK-57451][CORE] Remove the check rejecting `spark.authenticate.se…
dongjoon-hyun Jun 15, 2026
def9100
[SPARK-57498][SQL] Strengthen cookie-signing secret in ThriftHttpServlet
dongjoon-hyun Jun 17, 2026
3960c2a
[SPARK-57474][CORE] Validate length before allocation in `Encoders.St…
dongjoon-hyun Jun 15, 2026
7cca942
[SPARK-57475][CORE] Validate length before allocation in `Encoders.Bi…
dongjoon-hyun Jun 15, 2026
785ff22
[SPARK-56724][INFRA][4.2] Make docker/* GitHub Actions up-to-date
dongjoon-hyun Jun 17, 2026
979d2dc
[SPARK-53209][YARN][FOLLOWUP][4.2] Move `spark.yarn.am.limitActivePro…
pan3793 Jun 17, 2026
534b59d
[SPARK-57485][BUILD] Exclude package-private Scala types from the gen…
cloud-fan Jun 17, 2026
eee39a2
[SPARK-57452][DOC] Add missing 4.2 behavior changes to migration guides
cloud-fan Jun 17, 2026
64684f8
[SPARK-57509][CORE] Return `FORBIDDEN` instead of `METHOD_NOT_ALLOWED…
dongjoon-hyun Jun 17, 2026
a0e459c
[SPARK-57496][4.2][SQL][BUILD] Keep the Types Framework ops and UDF w…
cloud-fan Jun 17, 2026
e12240f
[SPARK-57510][CORE] Enforce the modify ACL on the `/workers/kill` end…
dongjoon-hyun Jun 17, 2026
445e35f
[SPARK-57477][PYTHON][TEST] Remove `labels` test for boxplot
gaogaotiantian Jun 15, 2026
5e9c4b8
[SPARK-57445][SQL] Fix PushVariantIntoScan exception semantics.
chenhao-db Jun 17, 2026
16086bc
Revert "[SPARK-57445][SQL] Fix PushVariantIntoScan exception semantics."
dongjoon-hyun Jun 18, 2026
cea76e4
[SPARK-57364][SQL] Fix Oracle TRUNC pushdown to map Spark format stri…
shrirangmhalgi Jun 18, 2026
c383a94
[SPARK-57505][SQL] Do not wrap window functions in an `AggregateExpre…
peter-toth Jun 18, 2026
478c317
[SPARK-57529][SQL] Fix possible ORC reader leak in OrcPartitionReader…
cxzl25 Jun 18, 2026
2cfb0ab
[SPARK-57336][CONNECT] Send the bearer token in the standard Authoriz…
j1wonpark Jun 18, 2026
b8fab80
[SPARK-57538][YARN] Revise a warning message in `YarnShuffleService`
dongjoon-hyun Jun 18, 2026
9eb44a4
[SPARK-57371][CONNECT] Fix data race in ArrowDeserializers
haiyangsun-db Jun 18, 2026
726adfb
Revert "[SPARK-56555][K8S] Add ubuntu mirror repositories to K8s Dock…
dongjoon-hyun Jun 18, 2026
8ed470b
[SPARK-57507][SQL] Fix `UTF8String.reverse` reading past the end of a…
LuciferYang Jun 19, 2026
f1f369d
[SPARK-57506][SQL] Fix RTRIM-collation trimRight dropping trailing sp…
LuciferYang Jun 19, 2026
360bab8
[SPARK-56032][SQL][FOLLOWUP] Skip FilterExec CSE codegen when every c…
cloud-fan Jun 21, 2026
245179e
[SPARK-57580][SQL] Redact credentials embedded in JDBC URLs
cloud-fan Jun 21, 2026
387dc07
[SPARK-54918][SQL] Clean up text of `NormalizeFloatingNumbers` docstring
nchammas Jun 21, 2026
45e4208
[SPARK-57329][SQL] mode() returns incorrect result when input contain…
jiwen624 Jun 21, 2026
f49cb12
[SPARK-56919][SQL] Move setupJob before materializeAdaptiveSparkPlan …
shrirangmhalgi Jun 21, 2026
484cd71
[SPARK-57589][CORE] Support `spark.ui.contentSecurityPolicy.enabled`
dongjoon-hyun Jun 22, 2026
e97565b
[SPARK-57520][SQL] Fix UTF8String.codePointFrom and copyUTF8String re…
LuciferYang Jun 22, 2026
f223a16
[SPARK-57581][4.2][SQL] Encode the TIME data type in Avro with a unit…
MaxGekk Jun 22, 2026
37fae57
[SPARK-57547][SQL] Fix incorrect InMemoryRelation materialization und…
liuzqt Jun 22, 2026
3c5f606
[SPARK-57610][4.2][SQL][TEST] Tolerate null ArithmeticException messa…
HyukjinKwon Jun 23, 2026
bf78164
[SPARK-52729][SQL][FOLLOWUP] Model table and view as a common Relation
cloud-fan Jun 23, 2026
9791e6e
[SPARK-57601][CONNECT][UI] Make the Spark Connect tab available in th…
j1wonpark Jun 23, 2026
54a22fb
[SPARK-57637][BUILD][TEST] Upgrade `oracle-free` docker image to `23.…
sarutak Jun 23, 2026
fd33cc3
[SPARK-57595][PYTHON] Declarative Pipelines analysis context should n…
LuciferYang Jun 24, 2026
c3d73f8
[SPARK-57647][SQL][TEST] Make `FileSourceStrategySuite` be independen…
dongjoon-hyun Jun 24, 2026
96ff1c2
[SPARK-57642][SQL] Require predicateSql to be present for the DSv2 CH…
gengliangwang Jun 24, 2026
3fa6f9f
[SPARK-57438][SS] Fix NullPointerException in Kafka source metrics wh…
yadavay-amzn Jun 24, 2026
10427c3
[SPARK-57650][YARN][TEST] Allow AMs to use the whole queue in BaseYar…
HyukjinKwon Jun 24, 2026
a9b8163
[SPARK-57667][SQL][TEST] Make SQL tests be independent from the defau…
dongjoon-hyun Jun 24, 2026
02df81d
[SPARK-57675][SQL][TEST] Mark `StateDataSourceTransformWithStateSuite…
dongjoon-hyun Jun 24, 2026
bd68c58
[SPARK-57683][SQL][TEST] Move `StateDataSourceTransformWithStateSuite…
dongjoon-hyun Jun 25, 2026
5fff7a7
[SPARK-57686][BUILD] Fix `log4j-slf4j2-impl` artifact name in `LICENS…
dongjoon-hyun Jun 25, 2026
80c1964
[SPARK-57662][CORE] Use unsigned byte comparison for KVStore iterator…
LuciferYang Jun 25, 2026
26bddfc
[SPARK-57687][BUILD] Add `arrow-compression` to `LICENSE-binary`
dongjoon-hyun Jun 25, 2026
27ab790
[SPARK-57682][BUILD] Add `javax.servlet-api` to `LICENSE-binary`
dongjoon-hyun Jun 25, 2026
1f4bb05
[SPARK-57689][BUILD] Replace `kubernetes-httpclient-okhttp` with `kub…
dongjoon-hyun Jun 25, 2026
f46a990
[SPARK-57599][SQL] Decode Variant strings and keys as UTF-8
LuciferYang Jun 25, 2026
29d0bc6
[SPARK-57697][SQL][TEST] Mark `HiveClientSuite` as `SlowHiveTest` lik…
dongjoon-hyun Jun 25, 2026
eadcd9a
[SPARK-57544][SQL] Rework column ID validation for nested fields in DSv2
aokolnychyi Jun 26, 2026
fbf99ce
Merge remote-tracking branch 'upstream/branch-4.2' into hotfix/NGSOK-…
giggsoff Jun 26, 2026
654942e
chore: bump version to 4.2.0.1-4.3.0-2
giggsoff Jun 26, 2026
87ac6bd
[SPARK-57652][4.2][SS][TEST] Deflake snapshotStartBatchId-with-transf…
HyukjinKwon Jun 26, 2026
38feeea
[SPARK-57719][SQL][TEST] Move `IdentifierClauseParserSuite` to the ca…
dongjoon-hyun Jun 26, 2026
2b014d6
[SPARK-57720][SQL] Fix `RealTimeModeAllowlist` package to match its d…
dongjoon-hyun Jun 26, 2026
4da95e7
[SPARK-57721][SQL] Fix `LowLatencyMemoryStream` package to match its …
dongjoon-hyun Jun 26, 2026
f92a807
Preparing Spark release v4.2.0-rc4
Jun 26, 2026
6d97c56
Merge tag 'v4.2.0-rc4' into hotfix/NGSOK-1746
giggsoff Jun 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions LICENSE-binary
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ io.dropwizard.metrics:metrics-json
io.dropwizard.metrics:metrics-jvm
io.fabric8:kubernetes-client
io.fabric8:kubernetes-client-api
io.fabric8:kubernetes-httpclient-okhttp
io.fabric8:kubernetes-httpclient-vertx
io.fabric8:kubernetes-model-admissionregistration
io.fabric8:kubernetes-model-apiextensions
io.fabric8:kubernetes-model-apps
Expand Down Expand Up @@ -305,6 +305,7 @@ joda-time:joda-time
net.sf.opencsv:opencsv
net.sf.supercsv:super-csv
net.sf.jpam:jpam
org.apache.arrow:arrow-compression
org.apache.arrow:arrow-format
org.apache.arrow:arrow-memory-core
org.apache.arrow:arrow-memory-netty
Expand Down Expand Up @@ -349,7 +350,7 @@ org.apache.logging.log4j:log4j-1.2-api
org.apache.logging.log4j:log4j-api
org.apache.logging.log4j:log4j-core
org.apache.logging.log4j:log4j-layout-template-json
org.apache.logging.log4j:log4j-slf4j-impl
org.apache.logging.log4j:log4j-slf4j2-impl
org.apache.orc:orc-core
org.apache.orc:orc-format
org.apache.orc:orc-mapreduce
Expand Down Expand Up @@ -510,6 +511,7 @@ javax.transaction:transaction-api
Common Development and Distribution License (CDDL) 1.1
------------------------------------------------------
javax.transaction:jta http://www.oracle.com/technetwork/java/index.html
javax.servlet:javax.servlet-api https://oss.oracle.com/licenses/CDDL+GPL-1.1
javax.xml.bind:jaxb-api https://github.com/javaee/jaxb-v2


Expand Down
2 changes: 1 addition & 1 deletion R/pkg/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: SparkR
Type: Package
Version: 4.2.0.1-4.3.0-1
Version: 4.2.0.1-4.3.0-2
Title: R Front End for 'Apache Spark'
Description: Provides an R Front end for 'Apache Spark' <https://spark.apache.org>.
Authors@R:
Expand Down
2 changes: 1 addition & 1 deletion assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.spark</groupId>
<artifactId>spark-parent_2.13</artifactId>
<version>4.2.0.1-4.3.0-1</version>
<version>4.2.0.1-4.3.0-2</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion common/kvstore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.spark</groupId>
<artifactId>spark-parent_2.13</artifactId>
<version>4.2.0.1-4.3.0-1</version>
<version>4.2.0.1-4.3.0-2</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.io.IOException;
import java.lang.ref.Cleaner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
Expand Down Expand Up @@ -289,17 +290,10 @@ private boolean isEndMarker(byte[] key) {
key[key.length - 1] == LevelDBTypeInfo.END_MARKER[0]);
}

@VisibleForTesting
static int compare(byte[] a, byte[] b) {
int diff = 0;
int minLen = Math.min(a.length, b.length);
for (int i = 0; i < minLen; i++) {
diff += (a[i] - b[i]);
if (diff != 0) {
return diff;
}
}

return a.length - b.length;
// Unsigned bytewise comparison, matching LevelDB's key ordering.
return Arrays.compareUnsigned(a, b);
}

static class ResourceCleaner implements Runnable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,17 +278,10 @@ private boolean isEndMarker(byte[] key) {
key[key.length - 1] == RocksDBTypeInfo.END_MARKER[0]);
}

@VisibleForTesting
static int compare(byte[] a, byte[] b) {
int diff = 0;
int minLen = Math.min(a.length, b.length);
for (int i = 0; i < minLen; i++) {
diff += (a[i] - b[i]);
if (diff != 0) {
return diff;
}
}

return a.length - b.length;
// Unsigned bytewise comparison, matching RocksDB's key ordering.
return Arrays.compareUnsigned(a, b);
}

static class ResourceCleaner implements Runnable {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.spark.util.kvstore;

import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;

/**
* Unit tests for the static byte-array comparator that LevelDBIterator and RocksDBIterator
* each define (the two backends are kept independent, so the method is duplicated). The
* comparator is pure and needs no database, so these tests run on every platform.
*/
public class DBIteratorCompareSuite {

@FunctionalInterface
private interface ByteArrayComparator {
int compare(byte[] a, byte[] b);
}

@Test
public void testLevelDBIteratorCompare() {
checkUnsignedByteOrdering(LevelDBIterator::compare);
}

@Test
public void testRocksDBIteratorCompare() {
checkUnsignedByteOrdering(RocksDBIterator::compare);
}

private static void checkUnsignedByteOrdering(ByteArrayComparator cmp) {
// Equal arrays compare equal.
assertEquals(0, cmp.compare(new byte[] { 1, 2, 3 }, new byte[] { 1, 2, 3 }));

// Empty arrays compare equal, and an empty array sorts before any non-empty one.
assertEquals(0, cmp.compare(new byte[] {}, new byte[] {}));
assertTrue(cmp.compare(new byte[] {}, new byte[] { 1 }) < 0);
assertTrue(cmp.compare(new byte[] { 1 }, new byte[] {}) > 0);

// A prefix sorts before the longer array that extends it.
assertTrue(cmp.compare(new byte[] { 1, 2 }, new byte[] { 1, 2, 3 }) < 0);
assertTrue(cmp.compare(new byte[] { 1, 2, 3 }, new byte[] { 1, 2 }) > 0);

// Bytes must be ordered as unsigned, matching the underlying key ordering: 0x80 (128) is
// greater than 0x7f (127). A signed comparison would wrongly treat 0x80 as -128.
byte[] highBit = new byte[] { (byte) 0x80 };
byte[] lowBit = new byte[] { 0x7f };
assertTrue(cmp.compare(highBit, lowBit) > 0);
assertTrue(cmp.compare(lowBit, highBit) < 0);

// 0xff (255) is the largest byte value when unsigned, so it sorts after 0x00.
assertTrue(cmp.compare(new byte[] { (byte) 0xff }, new byte[] { 0x00 }) > 0);

// The first differing byte decides the order, regardless of later bytes.
assertTrue(cmp.compare(new byte[] { 0x01, (byte) 0xff }, new byte[] { 0x02, 0x00 }) < 0);
}

}
2 changes: 1 addition & 1 deletion common/network-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.spark</groupId>
<artifactId>spark-parent_2.13</artifactId>
<version>4.2.0.1-4.3.0-1</version>
<version>4.2.0.1-4.3.0-2</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.Objects;

import io.netty.buffer.ByteBuf;
import org.roaringbitmap.RoaringBitmap;
Expand All @@ -41,6 +42,7 @@ public static void encode(ByteBuf buf, String s) {

public static String decode(ByteBuf buf) {
int length = buf.readInt();
Objects.checkFromIndexSize(0, length, buf.readableBytes());
byte[] bytes = new byte[length];
buf.readBytes(bytes);
return new String(bytes, StandardCharsets.UTF_8);
Expand Down Expand Up @@ -105,6 +107,7 @@ public static void encode(ByteBuf buf, byte[] arr) {

public static byte[] decode(ByteBuf buf) {
int length = buf.readInt();
Objects.checkFromIndexSize(0, length, buf.readableBytes());
byte[] bytes = new byte[length];
buf.readBytes(bytes);
return bytes;
Expand All @@ -130,6 +133,7 @@ public static void encode(ByteBuf buf, String[] strings) {

public static String[] decode(ByteBuf buf) {
int numStrings = buf.readInt();
Objects.checkFromIndexSize(0, numStrings, buf.readableBytes() / 4);
String[] strings = new String[numStrings];
for (int i = 0; i < strings.length; i ++) {
strings[i] = Strings.decode(buf);
Expand All @@ -153,6 +157,7 @@ public static void encode(ByteBuf buf, int[] ints) {

public static int[] decode(ByteBuf buf) {
int numInts = buf.readInt();
Objects.checkFromIndexSize(0, numInts, buf.readableBytes() / 4);
int[] ints = new int[numInts];
for (int i = 0; i < ints.length; i ++) {
ints[i] = buf.readInt();
Expand All @@ -176,6 +181,7 @@ public static void encode(ByteBuf buf, long[] longs) {

public static long[] decode(ByteBuf buf) {
int numLongs = buf.readInt();
Objects.checkFromIndexSize(0, numLongs, buf.readableBytes() / 8);
long[] longs = new long[numLongs];
for (int i = 0; i < longs.length; i ++) {
longs[i] = buf.readLong();
Expand Down Expand Up @@ -207,6 +213,9 @@ public static void encode(ByteBuf buf, RoaringBitmap[] bitmaps) {

public static RoaringBitmap[] decode(ByteBuf buf) {
int numBitmaps = buf.readInt();
// The divisor 8 is the minimum on-wire size of one element, since an empty RoaringBitmap
// serializes to 8 bytes (a 4-byte cookie followed by a 4-byte size).
Objects.checkFromIndexSize(0, numBitmaps, buf.readableBytes() / 8);
RoaringBitmap[] bitmaps = new RoaringBitmap[numBitmaps];
for (int i = 0; i < bitmaps.length; i ++) {
bitmaps[i] = Bitmaps.decode(buf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,28 @@ public void testRoaringBitmapEncodeShouldFailWhenBufferIsSmall() {
() -> Encoders.Bitmaps.encode(buf, bitmap));
}

@Test
public void testStringsEncodeDecode() {
String s = "spark";
ByteBuf buf = Unpooled.buffer(Encoders.Strings.encodedLength(s));
Encoders.Strings.encode(buf, s);
assertEquals(s, Encoders.Strings.decode(buf));
}

@Test
public void testStringsDecodeShouldFailWhenLengthIsNegative() {
ByteBuf buf = Unpooled.buffer();
buf.writeInt(-1);
assertThrows(IndexOutOfBoundsException.class, () -> Encoders.Strings.decode(buf));
}

@Test
public void testStringsDecodeShouldFailWhenLengthExceedsReadableBytes() {
ByteBuf buf = Unpooled.buffer();
buf.writeInt(Integer.MAX_VALUE);
assertThrows(IndexOutOfBoundsException.class, () -> Encoders.Strings.decode(buf));
}

@Test
public void testBitmapArraysEncodeDecode() {
RoaringBitmap[] bitmaps = new RoaringBitmap[] {
Expand All @@ -66,4 +88,106 @@ public void testBitmapArraysEncodeDecode() {
RoaringBitmap[] decodedBitmaps = Encoders.BitmapArrays.decode(buf);
assertArrayEquals(bitmaps, decodedBitmaps);
}

@Test
public void testBitmapArraysDecodeShouldFailWhenLengthIsNegative() {
ByteBuf buf = Unpooled.buffer();
buf.writeInt(-1);
assertThrows(IndexOutOfBoundsException.class, () -> Encoders.BitmapArrays.decode(buf));
}

@Test
public void testBitmapArraysDecodeShouldFailWhenLengthExceedsReadableBytes() {
ByteBuf buf = Unpooled.buffer();
buf.writeInt(Integer.MAX_VALUE);
assertThrows(IndexOutOfBoundsException.class, () -> Encoders.BitmapArrays.decode(buf));
}

@Test
public void testByteArraysEncodeDecode() {
byte[] arr = new byte[] { 1, 2, 3, 4, 5 };
ByteBuf buf = Unpooled.buffer(Encoders.ByteArrays.encodedLength(arr));
Encoders.ByteArrays.encode(buf, arr);
assertArrayEquals(arr, Encoders.ByteArrays.decode(buf));
}

@Test
public void testByteArraysDecodeShouldFailWhenLengthIsNegative() {
ByteBuf buf = Unpooled.buffer();
buf.writeInt(-1);
assertThrows(IndexOutOfBoundsException.class, () -> Encoders.ByteArrays.decode(buf));
}

@Test
public void testByteArraysDecodeShouldFailWhenLengthExceedsReadableBytes() {
ByteBuf buf = Unpooled.buffer();
buf.writeInt(Integer.MAX_VALUE);
assertThrows(IndexOutOfBoundsException.class, () -> Encoders.ByteArrays.decode(buf));
}

@Test
public void testIntArraysEncodeDecode() {
int[] arr = new int[] { 1, 2, 3, 4, 5 };
ByteBuf buf = Unpooled.buffer(Encoders.IntArrays.encodedLength(arr));
Encoders.IntArrays.encode(buf, arr);
assertArrayEquals(arr, Encoders.IntArrays.decode(buf));
}

@Test
public void testIntArraysDecodeShouldFailWhenLengthIsNegative() {
ByteBuf buf = Unpooled.buffer();
buf.writeInt(-1);
assertThrows(IndexOutOfBoundsException.class, () -> Encoders.IntArrays.decode(buf));
}

@Test
public void testIntArraysDecodeShouldFailWhenLengthExceedsReadableBytes() {
ByteBuf buf = Unpooled.buffer();
buf.writeInt(Integer.MAX_VALUE);
assertThrows(IndexOutOfBoundsException.class, () -> Encoders.IntArrays.decode(buf));
}

@Test
public void testLongArraysEncodeDecode() {
long[] arr = new long[] { 1L, 2L, 3L, 4L, 5L };
ByteBuf buf = Unpooled.buffer(Encoders.LongArrays.encodedLength(arr));
Encoders.LongArrays.encode(buf, arr);
assertArrayEquals(arr, Encoders.LongArrays.decode(buf));
}

@Test
public void testLongArraysDecodeShouldFailWhenLengthIsNegative() {
ByteBuf buf = Unpooled.buffer();
buf.writeInt(-1);
assertThrows(IndexOutOfBoundsException.class, () -> Encoders.LongArrays.decode(buf));
}

@Test
public void testLongArraysDecodeShouldFailWhenLengthExceedsReadableBytes() {
ByteBuf buf = Unpooled.buffer();
buf.writeInt(Integer.MAX_VALUE);
assertThrows(IndexOutOfBoundsException.class, () -> Encoders.LongArrays.decode(buf));
}

@Test
public void testStringArraysEncodeDecode() {
String[] arr = new String[] { "spark", "", "rocks" };
ByteBuf buf = Unpooled.buffer(Encoders.StringArrays.encodedLength(arr));
Encoders.StringArrays.encode(buf, arr);
assertArrayEquals(arr, Encoders.StringArrays.decode(buf));
}

@Test
public void testStringArraysDecodeShouldFailWhenLengthIsNegative() {
ByteBuf buf = Unpooled.buffer();
buf.writeInt(-1);
assertThrows(IndexOutOfBoundsException.class, () -> Encoders.StringArrays.decode(buf));
}

@Test
public void testStringArraysDecodeShouldFailWhenLengthExceedsReadableBytes() {
ByteBuf buf = Unpooled.buffer();
buf.writeInt(Integer.MAX_VALUE);
assertThrows(IndexOutOfBoundsException.class, () -> Encoders.StringArrays.decode(buf));
}
}
2 changes: 1 addition & 1 deletion common/network-shuffle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.spark</groupId>
<artifactId>spark-parent_2.13</artifactId>
<version>4.2.0.1-4.3.0-1</version>
<version>4.2.0.1-4.3.0-2</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Loading
Loading