Skip to content

Commit 5490104

Browse files
committed
ref: bump versions to latest
Versions bumped: atrium: 0.13.0 → 0.16.0 kotest: 4.2.5 → 4.6.0 kotest-allure: changed groupId and bumped to 1.0.1 klaxon: 5.4 → 5.5
1 parent 5f1ee8d commit 5490104

File tree

11 files changed

+502
-385
lines changed

11 files changed

+502
-385
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*-
2+
* =LICENSE=
3+
* Kotlin Spark API: Examples for Spark 2.4+ (Scala 2.11)
4+
* ----------
5+
* Copyright (C) 2019 - 2021 JetBrains
6+
* ----------
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* =LICENSEEND=
19+
*/
20+
package org.jetbrains.kotlinx.spark.examples
21+
22+
import org.jetbrains.kotlinx.spark.api.*
23+
24+
fun main() {
25+
withSpark {
26+
dsOf(c(1, "a"), c(1, "b"), c(2, "c"))
27+
.groupByKey { it._1 }
28+
.reduceGroupsK { a, b -> c(a._1 + b._1, a._2 + b._2) }
29+
.show()
30+
}
31+
}

kotlin-spark-api/2.4/pom_2.11.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
<scope>test</scope>
4949
</dependency>
5050
<dependency>
51-
<groupId>io.kotest</groupId>
52-
<artifactId>kotest-extensions-allure-jvm</artifactId>
53-
<version>${kotest.version}</version>
51+
<groupId>io.kotest.extensions</groupId>
52+
<artifactId>kotest-extensions-allure</artifactId>
53+
<version>${kotest-extension-allure.version}</version>
5454
<scope>test</scope>
5555
</dependency>
5656
<dependency>

kotlin-spark-api/2.4/pom_2.12.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
<scope>test</scope>
4949
</dependency>
5050
<dependency>
51-
<groupId>io.kotest</groupId>
52-
<artifactId>kotest-extensions-allure-jvm</artifactId>
53-
<version>${kotest.version}</version>
51+
<groupId>io.kotest.extensions</groupId>
52+
<artifactId>kotest-extensions-allure</artifactId>
53+
<version>${kotest-extension-allure.version}</version>
5454
<scope>test</scope>
5555
</dependency>
5656
<dependency>

kotlin-spark-api/2.4/src/main/kotlin/org/jetbrains/kotlinx/spark/api/ApiV1.kt

Lines changed: 104 additions & 79 deletions
Large diffs are not rendered by default.

kotlin-spark-api/2.4/src/test/kotlin/org/jetbrains/kotlinx/spark/api/ApiTest.kt

Lines changed: 55 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ package org.jetbrains.kotlinx.spark.api/*-
1818
* =LICENSEEND=
1919
*/
2020
import ch.tutteli.atrium.api.fluent.en_GB.*
21-
import ch.tutteli.atrium.domain.builders.migration.asExpect
22-
import ch.tutteli.atrium.verbs.expect
21+
import ch.tutteli.atrium.api.verbs.expect
2322
import io.kotest.core.spec.style.ShouldSpec
2423
import io.kotest.matchers.shouldBe
2524
import org.apache.spark.sql.streaming.GroupState
@@ -36,7 +35,6 @@ import java.io.Serializable
3635
import java.sql.Date
3736
import java.sql.Timestamp
3837
import java.time.LocalDate
39-
import kotlin.reflect.KProperty1
4038
import scala.collection.Iterator as ScalaIterator
4139
import scala.collection.Map as ScalaMap
4240
import scala.collection.mutable.Map as ScalaMutableMap
@@ -48,33 +46,37 @@ class ApiTest : ShouldSpec({
4846
val ll1 = LonLat(1.0, 2.0)
4947
val ll2 = LonLat(3.0, 4.0)
5048
val lonlats = dsOf(ll1, ll2).collectAsList()
51-
expect(lonlats).asExpect().contains.inAnyOrder.only.values(ll1.copy(), ll2.copy())
49+
expect(lonlats).contains.inAnyOrder.only.values(ll1.copy(), ll2.copy())
5250
}
5351
should("contain all generic primitives with complex schema") {
5452
val primitives = c(1, 1.0, 1.toFloat(), 1.toByte(), LocalDate.now(), true)
5553
val primitives2 = c(2, 2.0, 2.toFloat(), 2.toByte(), LocalDate.now().plusDays(1), false)
5654
val tuples = dsOf(primitives, primitives2).collectAsList()
57-
expect(tuples).asExpect().contains.inAnyOrder.only.values(primitives, primitives2)
55+
expect(tuples).contains.inAnyOrder.only.values(primitives, primitives2)
5856
}
5957
should("contain all generic primitives with complex nullable schema") {
6058
val primitives = c(1, 1.0, 1.toFloat(), 1.toByte(), LocalDate.now(), true)
6159
val nulls = c(null, null, null, null, null, null)
6260
val tuples = dsOf(primitives, nulls).collectAsList()
63-
expect(tuples).asExpect().contains.inAnyOrder.only.values(primitives, nulls)
61+
expect(tuples).contains.inAnyOrder.only.values(primitives, nulls)
6462
}
6563
should("handle cached operations") {
6664
val result = dsOf(1, 2, 3, 4, 5)
67-
.map { it to (it + 2) }
68-
.withCached {
69-
expect(collectAsList()).asExpect().contains.inAnyOrder.only.values(1 to 3, 2 to 4, 3 to 5, 4 to 6, 5 to 7)
70-
71-
val next = filter { it.first % 2 == 0 }
72-
expect(next.collectAsList()).asExpect().contains.inAnyOrder.only.values(2 to 4, 4 to 6)
73-
next
74-
}
75-
.map { c(it.first, it.second, (it.first + it.second) * 2) }
76-
.collectAsList()
77-
expect(result).asExpect().contains.inOrder.only.values(c(2, 4, 12), c(4, 6, 20))
65+
.map { it to (it + 2) }
66+
.withCached {
67+
expect(collectAsList()).contains.inAnyOrder.only.values(1 to 3,
68+
2 to 4,
69+
3 to 5,
70+
4 to 6,
71+
5 to 7)
72+
73+
val next = filter { it.first % 2 == 0 }
74+
expect(next.collectAsList()).contains.inAnyOrder.only.values(2 to 4, 4 to 6)
75+
next
76+
}
77+
.map { c(it.first, it.second, (it.first + it.second) * 2) }
78+
.collectAsList()
79+
expect(result).contains.inOrder.only.values(c(2, 4, 12), c(4, 6, 20))
7880
}
7981
should("handle join operations") {
8082
data class Left(val id: Int, val name: String)
@@ -84,34 +86,34 @@ class ApiTest : ShouldSpec({
8486
val first = dsOf(Left(1, "a"), Left(2, "b"))
8587
val second = dsOf(Right(1, 100), Right(3, 300))
8688
val result = first
87-
.leftJoin(second, first.col("id").eq(second.col("id")))
88-
.map { c(it.first.id, it.first.name, it.second?.value) }
89-
.collectAsList()
90-
expect(result).asExpect().contains.inOrder.only.values(c(1, "a", 100), c(2, "b", null))
89+
.leftJoin(second, first.col("id").eq(second.col("id")))
90+
.map { c(it.first.id, it.first.name, it.second?.value) }
91+
.collectAsList()
92+
expect(result).contains.inOrder.only.values(c(1, "a", 100), c(2, "b", null))
9193
}
9294
should("handle map operations") {
9395
expect(
94-
dsOf(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6))
95-
.flatMap { it.iterator() }
96-
.map { it + 4 }
97-
.filter { it < 10 }
98-
.collectAsList()
96+
dsOf(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6))
97+
.flatMap { it.iterator() }
98+
.map { it + 4 }
99+
.filter { it < 10 }
100+
.collectAsList()
99101
)
100-
.asExpect()
101-
.contains
102-
.inAnyOrder
103-
.only
104-
.values(5, 6, 7, 8, 7, 8, 9)
102+
.contains
103+
.inAnyOrder
104+
.only
105+
.values(5, 6, 7, 8, 7, 8, 9)
105106
}
106107
should("hadle strings converted to lists") {
107108
data class Movie(val id: Long, val genres: String)
108109
data class MovieExpanded(val id: Long, val genres: List<String>)
109110

110111
val comedies = listOf(Movie(1, "Comedy|Romance"), Movie(2, "Horror|Action")).toDS()
111-
.map { MovieExpanded(it.id, it.genres.split("|").toList()) }
112-
.filter { it.genres.contains("Comedy") }
113-
.collectAsList()
114-
expect(comedies).asExpect().contains.inAnyOrder.only.values(MovieExpanded(1, listOf("Comedy", "Romance")))
112+
.map { MovieExpanded(it.id, it.genres.split("|").toList()) }
113+
.filter { it.genres.contains("Comedy") }
114+
.collectAsList()
115+
expect(comedies).contains.inAnyOrder.only.values(MovieExpanded(1,
116+
listOf("Comedy", "Romance")))
115117
}
116118
should("handle strings converted to arrays") {
117119
data class Movie(val id: Long, val genres: String)
@@ -131,27 +133,28 @@ class ApiTest : ShouldSpec({
131133
}
132134

133135
val comedies = listOf(Movie(1, "Comedy|Romance"), Movie(2, "Horror|Action")).toDS()
134-
.map { MovieExpanded(it.id, it.genres.split("|").toTypedArray()) }
135-
.filter { it.genres.contains("Comedy") }
136-
.collectAsList()
137-
expect(comedies).asExpect().contains.inAnyOrder.only.values(MovieExpanded(1, arrayOf("Comedy", "Romance")))
136+
.map { MovieExpanded(it.id, it.genres.split("|").toTypedArray()) }
137+
.filter { it.genres.contains("Comedy") }
138+
.collectAsList()
139+
expect(comedies).contains.inAnyOrder.only.values(MovieExpanded(1,
140+
arrayOf("Comedy", "Romance")))
138141
}
139142
should("!handle arrays of generics") {
140143

141144
val result = listOf(Test(1, arrayOf(5.1 to 6, 6.1 to 7)))
142-
.toDS()
143-
.map { it.id to it.data.first { liEl -> liEl.first < 6 } }
144-
.map { it.second }
145-
.collectAsList()
146-
expect(result).asExpect().contains.inOrder.only.values(5.1 to 6)
145+
.toDS()
146+
.map { it.id to it.data.first { liEl -> liEl.first < 6 } }
147+
.map { it.second }
148+
.collectAsList()
149+
expect(result).contains.inOrder.only.values(5.1 to 6)
147150
}
148151
should("handle primitive arrays") {
149152
val result = listOf(arrayOf(1, 2, 3, 4))
150-
.toDS()
151-
.map { it.map { ai -> ai + 1 } }
152-
.collectAsList()
153-
.flatten()
154-
expect(result).asExpect().contains.inOrder.only.values(2, 3, 4, 5)
153+
.toDS()
154+
.map { it.map { ai -> ai + 1 } }
155+
.collectAsList()
156+
.flatten()
157+
expect(result).contains.inOrder.only.values(2, 3, 4, 5)
155158

156159
}
157160
@OptIn(ExperimentalStdlibApi::class)
@@ -174,7 +177,7 @@ class ApiTest : ShouldSpec({
174177
}
175178
.collectAsList()
176179

177-
expect(result).asExpect().contains.inOrder.only.values(3.0, 5.0, 7.0, 9.0, 11.0)
180+
expect(result).contains.inOrder.only.values(3.0, 5.0, 7.0, 9.0, 11.0)
178181
}
179182
should("Handle JavaConversions in Kotlin") {
180183
// Test the iterator conversion
@@ -444,7 +447,7 @@ class ApiTest : ShouldSpec({
444447
)
445448
dataset.forEachPartition {
446449
it.forEach {
447-
it.b shouldBe 1
450+
it.b shouldBe 1
448451
}
449452
}
450453
}
@@ -454,7 +457,7 @@ class ApiTest : ShouldSpec({
454457
SomeClass(intArrayOf(4, 3, 2), 1),
455458
)
456459
.groupByKey { it.b }
457-
.reduceGroups(func = { a, b -> SomeClass(a.a + b.a, a.b) })
460+
.reduceGroupsK(func = { a, b -> SomeClass(a.a + b.a, a.b) })
458461
.takeValues()
459462

460463
dataset.count() shouldBe 1

0 commit comments

Comments
 (0)