Skip to content

Commit 8c5adc3

Browse files
committed
Merge branch 'main' into release
2 parents 213260b + 28a8496 commit 8c5adc3

File tree

42 files changed

+3043
-318
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3043
-318
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
-Pspark=${{ matrix.spark }}
6060
-Pscala=${{ matrix.scala }}
6161
clean
62-
build
62+
test
6363
--scan
6464
6565
# qodana:

.github/workflows/publish_dev_version.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,25 @@ jobs:
5757
- name: Validate Gradle wrapper
5858
uses: gradle/wrapper-validation-action@v1
5959

60-
- name: Deploy to GH Packages with Gradle
60+
- name: Setup Gradle
6161
uses: gradle/gradle-build-action@v2
62+
63+
- name: Set Swap Space
64+
uses: pierotofy/set-swap-space@master
6265
with:
63-
arguments: |
64-
-Pspark=${{ matrix.spark }}
65-
-Pscala=${{ matrix.scala }}
66-
-PskipScalaTuplesInKotlin=${{ !(matrix.spark == '3.0.0' || matrix.scala == '2.13.8' && matrix.spark == '3.2.0') }}
67-
clean
68-
publishMavenPublicationToGitHubPackagesRepository
69-
--scan
66+
swap-size-gb: 12
67+
68+
- name: Deploy to GH Packages with Gradle
7069
env:
7170
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
run: >
72+
./gradlew
73+
-Pspark=${{ matrix.spark }}
74+
-Pscala=${{ matrix.scala }}
75+
-PskipScalaTuplesInKotlin=${{ !(matrix.spark == '3.0.0' || matrix.scala == '2.13.8' && matrix.spark == '3.2.0') }}
76+
clean
77+
publishMavenPublicationToGitHubPackagesRepository
78+
--scan
79+
7280
7381
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Deploy release version to Maven Central
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build-and-deploy-mvn-central:
9+
strategy:
10+
matrix:
11+
scala: [ "2.12.15", "2.13.8" ]
12+
spark: [ "3.3.0", "3.2.1", "3.2.0", "3.1.3", "3.1.2", "3.1.1", "3.1.0", "3.0.3", "3.0.2", "3.0.1", "3.0.0" ]
13+
exclude:
14+
- scala: "2.13.8"
15+
spark: "3.1.3"
16+
- scala: "2.13.8"
17+
spark: "3.1.2"
18+
- scala: "2.13.8"
19+
spark: "3.1.1"
20+
- scala: "2.13.8"
21+
spark: "3.1.0"
22+
- scala: "2.13.8"
23+
spark: "3.0.3"
24+
- scala: "2.13.8"
25+
spark: "3.0.2"
26+
- scala: "2.13.8"
27+
spark: "3.0.1"
28+
- scala: "2.13.8"
29+
spark: "3.0.0"
30+
runs-on: ubuntu-latest
31+
permissions:
32+
contents: read
33+
packages: write
34+
35+
steps:
36+
- uses: actions/checkout@v3
37+
38+
- name: Set up JDK 11
39+
uses: actions/setup-java@v3
40+
with:
41+
distribution: adopt
42+
java-version: 11
43+
check-latest: true
44+
server-id: ossrh
45+
server-username: ORG_GRADLE_PROJECT_mavenCentralUsername
46+
server-password: ORG_GRADLE_PROJECT_mavenCentralPassword
47+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
48+
gpg-passphrase: ORG_GRADLE_PROJECT_signingInMemoryKeyPassword
49+
50+
- name: Cache Gradle packages
51+
uses: actions/cache@v3
52+
with:
53+
path: |
54+
~/.gradle/caches
55+
~/.gradle/wrapper
56+
~/.gradle/jdks
57+
key: ${{ runner.os }}-gradle-spark-${{ matrix.spark }}-${{ matrix.scala }}
58+
restore-keys: |
59+
${{ runner.os }}-gradle-
60+
61+
- name: Validate Gradle wrapper
62+
uses: gradle/wrapper-validation-action@v1
63+
64+
- name: Setup Gradle
65+
uses: gradle/gradle-build-action@v2
66+
67+
- name: Set Swap Space
68+
uses: pierotofy/set-swap-space@master
69+
with:
70+
swap-size-gb: 12
71+
72+
73+
- name: Deploy to Maven Central with Gradle
74+
env:
75+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
76+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_TOKEN }}
77+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
78+
run: >
79+
./gradlew
80+
-Pspark=${{ matrix.spark }}
81+
-Pscala=${{ matrix.scala }}
82+
-PskipScalaTuplesInKotlin=${{ !(matrix.spark == '3.0.0' || matrix.scala == '2.13.8' && matrix.spark == '3.2.0') }}
83+
clean
84+
publishMavenPublicationToMavenCentralRepository
85+
--scan
86+
87+
88+

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Kotlin Stable](https://kotl.in/badges/stable.svg)](https://kotlinlang.org/docs/components-stability.html)
44
[![JetBrains official project](http://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
5-
[![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx.spark/kotlin-spark-api-parent-3.2.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:org.jetbrains.kotlinx.spark%20AND%20v:1.1.0)
5+
[![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx.spark/kotlin-spark-api_3.3.0_2.13.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:"org.jetbrains.kotlinx.spark"%20AND%20a:"kotlin-spark-api_3.3.0_2.13")
66
[![Join the chat at https://gitter.im/JetBrains/kotlin-spark-api](https://badges.gitter.im/JetBrains/kotlin-spark-api.svg)](https://gitter.im/JetBrains/kotlin-spark-api?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
77

88
Your next API to work with [Apache Spark](https://spark.apache.org/).
@@ -62,9 +62,12 @@ We have opened a Spark Project Improvement Proposal: [Kotlin support for Apache
6262

6363
The list of Kotlin for Apache Spark releases is available [here](https://github.com/JetBrains/kotlin-spark-api/releases/).
6464
The Kotlin for Spark artifacts adhere to the following convention:
65-
`[Apache Spark version]_[Scala core version]:[Kotlin for Apache Spark API version]`
65+
`[name]_[Apache Spark version]_[Scala core version]:[Kotlin for Apache Spark API version]`
6666

67-
[![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx.spark/kotlin-spark-api-parent-3.2.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:"org.jetbrains.kotlinx.spark"%20AND%20a:"kotlin-spark-api-3.2")
67+
The only exception to this is `scala-tuples-in-kotlin_[Scala core version]:[Kotlin for Apache Spark API version]`, which is
68+
independent of Spark.
69+
70+
[![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx.spark/kotlin-spark-api_3.3.0_2.13.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:"org.jetbrains.kotlinx.spark"%20AND%20a:"kotlin-spark-api_3.3.0_2.13")
6871

6972
## How to configure Kotlin for Apache Spark in your project
7073

@@ -360,7 +363,7 @@ Of the [main](https://github.com/Kotlin/kotlin-spark-api/tree/main) branch, deve
360363
[GitHub Packages](https://github.com/orgs/Kotlin/packages?tab=packages&q=kotlin-spark-api). This way, new features can be
361364
tested quickly without having to wait for a full release.
362365

363-
For full releases, the `release` branch is updated.
366+
For full releases, the [release](https://github.com/Kotlin/kotlin-spark-api/tree/release) branch is updated.
364367

365368
## Code of Conduct
366369
This project and the corresponding community is governed by the [JetBrains Open Source and Community Code of Conduct](https://confluence.jetbrains.com/display/ALL/JetBrains+Open+Source+and+Community+Code+of+Conduct). Please make sure you read it.

build.gradle.kts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ plugins {
1515
mavenPublish version Versions.mavenPublish
1616
dokka version Versions.dokka
1717
idea
18+
kotlin version Versions.kotlin apply false
1819
}
1920

2021
group = Versions.groupID
@@ -58,6 +59,12 @@ allprojects {
5859
// ORG_GRADLE_PROJECT_mavenCentralUsername and
5960
// ORG_GRADLE_PROJECT_mavenCentralPassword.
6061

62+
// also ORG_GRADLE_PROJECT_signingInMemoryKey=exported_ascii_armored_key
63+
// # optional
64+
// ORG_GRADLE_PROJECT_signingInMemoryKeyId=24875D73
65+
// # if key was created with a password
66+
// ORG_GRADLE_PROJECT_signingInMemoryKeyPassword=secret
67+
6168
signAllPublications()
6269
pom {
6370
name.set("Kotlin Spark API")
@@ -101,12 +108,11 @@ allprojects {
101108
}
102109

103110
scm {
104-
connection.set("scm:git:https://github.com/JetBrains/kotlin-spark-api.git")
105-
url.set("https://github.com/JetBrains/kotlin-spark-api")
111+
connection.set("scm:git:https://github.com/Kotlin/kotlin-spark-api.git")
112+
url.set("https://github.com/Kotlin/kotlin-spark-api")
106113
tag.set("HEAD")
107114
}
108115
}
109-
110116
}
111117
}
112118
}

buildSrc/src/main/kotlin/Plugins.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import org.gradle.plugin.use.PluginDependenciesSpec
44

55

66
inline val PluginDependenciesSpec.kotlin
7-
get() = kotlin("jvm") version Versions.kotlin
7+
get() = kotlin("jvm")
88

99
inline val PluginDependenciesSpec.dokka
1010
get() = id("org.jetbrains.dokka")
@@ -15,7 +15,6 @@ inline val PluginDependenciesSpec.license
1515
inline val PluginDependenciesSpec.jcp
1616
get() = id("com.igormaznitsa.jcp")
1717

18-
1918
inline val DependencyHandlerScope.jcp
2019
get() = "com.igormaznitsa:jcp:${Versions.jcp}"
2120

buildSrc/src/main/kotlin/Versions.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ object Versions {
22
const val project = "1.1.1"
33
const val groupID = "org.jetbrains.kotlinx.spark"
44
const val kotlin = "1.7.10"
5+
const val jvmTarget = "11"
56

67
inline val spark get() = System.getProperty("spark") as String
78
inline val scala get() = System.getProperty("scala") as String
89
inline val sparkMinor get() = spark.substringBeforeLast('.')
910
inline val scalaCompat get() = scala.substringBeforeLast('.')
1011

11-
const val jupyter = "0.11.0-95"
12+
const val jupyter = "0.11.0-134"
1213
const val kotest = "5.3.2"
1314
const val kotestTestContainers = "1.3.3"
14-
const val dokka = "1.7.0"
15+
const val dokka = "1.7.10"
1516
const val jcp = "7.0.5"
1617
const val mavenPublish = "0.20.0"
1718
const val atrium = "0.17.0"
18-
const val kotestExtensionAllure = "1.1.0"
1919
const val licenseGradlePluginVersion = "0.15.0"
2020
const val kafkaStreamsTestUtils = "3.1.0"
2121
const val hadoop = "3.3.1"
@@ -29,6 +29,7 @@ object Versions {
2929
"scalaCompat" to scalaCompat,
3030
"spark" to spark,
3131
"sparkMinor" to sparkMinor,
32+
"version" to project,
3233
)
3334

3435
}

core/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
@file:Suppress("UnstableApiUsage")
1+
@file:Suppress("UnstableApiUsage", "NOTHING_TO_INLINE")
22

33
import com.igormaznitsa.jcp.gradle.JcpTask
44
import com.vanniktech.maven.publish.JavaLibrary
5-
import com.vanniktech.maven.publish.JavadocJar
65
import com.vanniktech.maven.publish.JavadocJar.Javadoc
76

87
plugins {
@@ -48,6 +47,7 @@ tasks.compileScala {
4847
outputs.upToDateWhen {
4948
preprocessMain.outcomingFiles.files.isEmpty()
5049
}
50+
5151
doFirst {
5252
scala {
5353
sourceSets {

core/src/main/scala/org/jetbrains/kotlinx/spark/extensions/KSparkExtensions.scala

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ package org.jetbrains.kotlinx.spark.extensions
2121

2222
import org.apache.spark.SparkContext
2323
import org.apache.spark.sql._
24-
2524
import java.util
26-
import scala.collection.JavaConverters
25+
import scala.reflect.ClassTag
2726

2827
object KSparkExtensions {
2928

@@ -39,7 +38,13 @@ object KSparkExtensions {
3938

4039
def lit(literal: Any): Column = functions.lit(literal)
4140

42-
def collectAsList[T](ds: Dataset[T]): util.List[T] = JavaConverters.seqAsJavaList(ds.collect())
41+
def collectAsList[T](ds: Dataset[T]): util.List[T] = {
42+
//#if scalaCompat >= 2.13
43+
scala.jdk.javaapi.CollectionConverters.asJava(ds.collect())
44+
//#else
45+
//$scala.collection.JavaConverters.seqAsJavaList(ds.collect())
46+
//#endif
47+
}
4348

4449

4550
def debugCodegen(df: Dataset[_]): Unit = {
@@ -53,4 +58,17 @@ object KSparkExtensions {
5358
}
5459

5560
def sparkContext(s: SparkSession): SparkContext = s.sparkContext
61+
62+
/**
63+
* Produces a ClassTag[T], which is actually just a casted ClassTag[AnyRef].
64+
*
65+
* This method is used to keep ClassTags out of the external Java API, as the Java compiler
66+
* cannot produce them automatically. While this ClassTag-faking does please the compiler,
67+
* it can cause problems at runtime if the Scala API relies on ClassTags for correctness.
68+
*
69+
* Often, though, a ClassTag[AnyRef] will not lead to incorrect behavior, just worse performance
70+
* or security issues. For instance, an Array[AnyRef] can hold any type T, but may lose primitive
71+
* specialization.
72+
*/
73+
def fakeClassTag[T]: ClassTag[T] = ClassTag.AnyRef.asInstanceOf[ClassTag[T]]
5674
}

examples/build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
13
plugins {
24
kotlin
35
idea
@@ -28,3 +30,9 @@ dependencies {
2830

2931
}
3032
}
33+
34+
tasks.withType<KotlinCompile> {
35+
kotlinOptions {
36+
jvmTarget = Versions.jvmTarget
37+
}
38+
}

0 commit comments

Comments
 (0)