Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Apache Spark
  3. Kotlin for Apache Spark

Kotlin for Apache Spark

Apache-2.0Kotlinv1.2.4

Kotlin bindings and extensions for Apache Spark, enabling idiomatic Kotlin development with data classes, lambdas, and null safety.

GitHubGitHub
481 stars37 forks0 contributors

What is Kotlin for Apache Spark?

Kotlin for Apache Spark is an open-source library that provides Kotlin bindings and extensions for Apache Spark. It enables developers to write Spark applications using Kotlin's concise syntax, null safety, and functional features, bridging the gap between Kotlin and Spark's native Scala/Java APIs. The project aims to make Spark more accessible to Kotlin developers while maintaining full compatibility with Spark's ecosystem.

Target Audience

Kotlin developers working with big data processing, data engineers, and data scientists who prefer Kotlin's modern language features and want to leverage Apache Spark for distributed computations.

Value Proposition

Developers choose this library because it provides an idiomatic Kotlin API for Spark, reducing boilerplate and improving type safety compared to using Spark's Java API directly. It offers seamless integration with Kotlin features like data classes, lambdas, and null safety, along with extras like Jupyter notebook support and enhanced UDF creation.

Overview

This projects gives Kotlin bindings and several extensions for Apache Spark. We are looking to have this as a part of Apache Spark 3.x

Use Cases

Best For

  • Writing Apache Spark applications in Kotlin instead of Scala or Java
  • Leveraging Kotlin's null safety and data classes for type-safe Spark transformations
  • Developing interactive data analysis pipelines in Kotlin Jupyter notebooks
  • Building real-time streaming applications with Spark Streaming using Kotlin DSL
  • Creating user-defined functions (UDFs) with type safety and smart naming in Spark SQL
  • Migrating existing Kotlin codebases to use Apache Spark for distributed processing

Not Ideal For

  • Projects requiring immediate adoption of the latest Apache Spark versions, due to dependency on specific Spark and Scala version combinations.
  • Teams already deeply invested in Scala or Python for Spark development, where the Kotlin layer adds unnecessary complexity.
  • Applications heavily reliant on niche Spark ecosystem libraries that may lack Kotlin bindings or documented integration.
  • Simple, one-off Spark scripts where the overhead of configuring Kotlin dependencies and version matching isn't justified.

Pros & Cons

Pros

Idiomatic Kotlin Syntax

Enables direct use of data classes, lambda expressions, and method references in Spark operations, reducing boilerplate code. The README shows examples like dsOf("a" to 1) for creating Datasets with Kotlin Pairs.

Enhanced Null Safety

Provides aliases such as leftJoin that enforce nullability, returning Dataset<Pair<LEFT, RIGHT?>> to prevent NullPointerException in distributed computations. This is highlighted in the Null safety section with practical examples.

Streamlined Streaming API

Offers Kotlin-esque functions like withSparkStreaming for Spark Streaming, automating context management and checkpointing. The README includes a full streaming example with automatic JavaStreamingContext handling.

Jupyter Notebook Integration

Supports seamless use in Kotlin Jupyter notebooks with %use spark magic for automatic Spark session initialization and HTML rendering of Datasets, as detailed in the Jupyter section with configuration examples.

Cons

Version Management Complexity

Requires precise alignment of Spark, Scala, and library versions, with artifact names like kotlin-spark-api_3.3.2_2.13, making setup error-prone. The README's configuration section emphasizes this dependency matching.

API Inconsistencies

Some Spark functions have renamed versions (e.g., reduceGroupsK instead of reduceGroups) due to overload resolution ambiguity, which can confuse developers familiar with standard Spark APIs. This is admitted in the Overload Resolution Ambiguity section.

Ecosystem Limitations

While it bridges Kotlin and Spark, integration with third-party Spark libraries or advanced Spark features may require additional workarounds, as the project focuses on core API compatibility rather than full ecosystem coverage.

Frequently Asked Questions

Quick Stats

Stars481
Forks37
Contributors0
Open Issues17
Last commit1 month ago
CreatedSince 2020

Tags

#apache-spark#spark#nullability#jupyter#scala#jvm#streaming#big-data#dataframes#data-processing#bigdata#kotlin#etl

Built With

K
Kotlin
M
Maven
S
Scala
J
Jupyter
A
Apache Spark
G
Gradle

Included in

Apache Spark1.9k
Auto-fetched 17 hours ago

Related Projects

.NET for Apache Spark.NET for Apache Spark

.NET for Apache® Spark™ makes Apache Spark™ easily accessible to .NET developers.

Stars2,097
Forks333
Last commit2 months ago
sparklyrsparklyr

R interface for Apache Spark

Stars971
Forks308
Last commit22 days ago
sparklesparkle

Haskell on Apache Spark.

Stars449
Forks27
Last commit11 months ago
spark-connect-gospark-connect-go

Apache Spark Connect Client for Golang

Stars253
Forks50
Last commit2 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub