All Projects → JetBrains → Kotlin Spark Api

JetBrains / Kotlin Spark Api

Licence: apache-2.0
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

Programming Languages

kotlin
9241 projects
scala
5932 projects

Projects that are alternatives of or similar to Kotlin Spark Api

Apache Spark Hands On
Educational notes,Hands on problems w/ solutions for hadoop ecosystem
Stars: ✭ 74 (-59.56%)
Mutual labels:  spark, bigdata
Bigdata Notebook
Stars: ✭ 100 (-45.36%)
Mutual labels:  spark, bigdata
Cleanframes
type-class based data cleansing library for Apache Spark SQL
Stars: ✭ 75 (-59.02%)
Mutual labels:  spark, bigdata
Bigdata Interview
🎯 🌟[大数据面试题]分享自己在网络上收集的大数据相关的面试题以及自己的答案总结.目前包含Hadoop/Hive/Spark/Flink/Hbase/Kafka/Zookeeper框架的面试题知识总结
Stars: ✭ 857 (+368.31%)
Mutual labels:  spark, bigdata
Hadoopcryptoledger
Hadoop Crypto Ledger - Analyzing CryptoLedgers, such as Bitcoin Blockchain, on Big Data platforms, such as Hadoop/Spark/Flink/Hive
Stars: ✭ 126 (-31.15%)
Mutual labels:  spark, bigdata
Optimus
🚚 Agile Data Preparation Workflows made easy with dask, cudf, dask_cudf and pyspark
Stars: ✭ 986 (+438.8%)
Mutual labels:  spark, bigdata
Bigdata Notes
大数据入门指南 ⭐
Stars: ✭ 10,991 (+5906.01%)
Mutual labels:  spark, bigdata
Spark Movie Lens
An on-line movie recommender using Spark, Python Flask, and the MovieLens dataset
Stars: ✭ 745 (+307.1%)
Mutual labels:  spark, bigdata
Lambda Arch
Applying Lambda Architecture with Spark, Kafka, and Cassandra.
Stars: ✭ 111 (-39.34%)
Mutual labels:  spark, bigdata
Sparktutorial
Source code for James Lee's Aparch Spark with Java course
Stars: ✭ 105 (-42.62%)
Mutual labels:  spark, bigdata
Mobius
C# and F# language binding and extensions to Apache Spark
Stars: ✭ 929 (+407.65%)
Mutual labels:  spark, bigdata
Ecommercerecommendsystem
商品大数据实时推荐系统。前端:Vue + TypeScript + ElementUI,后端 Spring + Spark
Stars: ✭ 139 (-24.04%)
Mutual labels:  spark, bigdata
Bigdataguide
大数据学习,从零开始学习大数据,包含大数据学习各阶段学习视频、面试资料
Stars: ✭ 817 (+346.45%)
Mutual labels:  spark, bigdata
Big Data Engineering Coursera Yandex
Big Data for Data Engineers Coursera Specialization from Yandex
Stars: ✭ 71 (-61.2%)
Mutual labels:  spark, bigdata
Coding Now
学习记录的一些笔记,以及所看得一些电子书eBooks、视频资源和平常收纳的一些自己认为比较好的博客、网站、工具。涉及大数据几大组件、Python机器学习和数据分析、Linux、操作系统、算法、网络等
Stars: ✭ 750 (+309.84%)
Mutual labels:  spark, bigdata
Spark Py Notebooks
Apache Spark & Python (pySpark) tutorials for Big Data Analysis and Machine Learning as IPython / Jupyter notebooks
Stars: ✭ 1,338 (+631.15%)
Mutual labels:  spark, bigdata
God Of Bigdata
专注大数据学习面试,大数据成神之路开启。Flink/Spark/Hadoop/Hbase/Hive...
Stars: ✭ 6,008 (+3183.06%)
Mutual labels:  spark, bigdata
Bigdataie
大数据博客、笔试题、教程、项目、面经的整理
Stars: ✭ 445 (+143.17%)
Mutual labels:  spark, bigdata
Splash
Splash, a flexible Spark shuffle manager that supports user-defined storage backends for shuffle data storage and exchange
Stars: ✭ 105 (-42.62%)
Mutual labels:  spark, bigdata
Spark
.NET for Apache® Spark™ makes Apache Spark™ easily accessible to .NET developers.
Stars: ✭ 1,721 (+840.44%)
Mutual labels:  spark, bigdata

Kotlin for Apache® Spark™ Maven Central official JetBrains project

Your next API to work with Apache Spark.

This project adds a missing layer of compatibility between Kotlin and Apache Spark. It allows Kotlin developers to use familiar language features such as data classes, and lambda expressions as simple expressions in curly braces or method references.

We have opened a Spark Project Improvement Proposal: Kotlin support for Apache Spark to work with the community towards getting Kotlin support as a first-class citizen in Apache Spark. We encourage you to voice your opinions and participate in the discussion.

Table of Contents

Supported versions of Apache Spark

Apache Spark Scala Kotlin for Apache Spark
3.0.0+ 2.12 kotlin-spark-api-3.0.0:1.0.0-preview2
2.4.1+ 2.12 kotlin-spark-api-2.4_2.12:1.0.0-preview2
2.4.1+ 2.11 kotlin-spark-api-2.4_2.11:1.0.0-preview2

Releases

The list of Kotlin for Apache Spark releases is available here. The Kotlin for Spark artifacts adhere to the following convention: [Apache Spark version]_[Scala core version]:[Kotlin for Apache Spark API version]

Maven Central

How to configure Kotlin for Apache Spark in your project

You can add Kotlin for Apache Spark as a dependency to your project: Maven, Gradle, SBT, and leinengen are supported.

Here's an example pom.xml:

<dependency>
  <groupId>org.jetbrains.kotlinx.spark</groupId>
  <artifactId>kotlin-spark-api-3.0.0</artifactId>
  <version>${kotlin-spark-api.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.spark</groupId>
    <artifactId>spark-sql_2.12</artifactId>
    <version>${spark.version}</version>
</dependency>

Note that core is being compiled against Scala version 2.12.
You can find a complete example with pom.xml and build.gradle in the Quick Start Guide.

Once you have configured the dependency, you only need to add the following import to your Kotlin file:

import org.jetbrains.kotlinx.spark.api.*

Kotlin for Apache Spark features

Creating a SparkSession in Kotlin

val spark = SparkSession
        .builder()
        .master("local[2]")
        .appName("Simple Application").orCreate

Creating a Dataset in Kotlin

spark.toDS("a" to 1, "b" to 2)

The example above produces Dataset<Pair<String, Int>>.

Null safety

There are several aliases in API, like leftJoin, rightJoin etc. These are null-safe by design. For example, leftJoin is aware of nullability and returns Dataset<Pair<LEFT, RIGHT?>>. Note that we are forcing RIGHT to be nullable for you as a developer to be able to handle this situation. NullPointerExceptions are hard to debug in Spark, and we doing our best to make them as rare as possible.

withSpark function

We provide you with useful function withSpark, which accepts everything that may be needed to run Spark — properties, name, master location and so on. It also accepts a block of code to execute inside Spark context.

After work block ends, spark.stop() is called automatically.

withSpark {
    dsOf(1, 2)
            .map { it to it }
            .show()
}

dsOf is just one more way to create Dataset (Dataset<Int>) from varargs.

withCached function

It can easily happen that we need to fork our computation to several paths. To compute things only once we should call cache method. However, it becomes difficult to control when we're using cached Dataset and when not. It is also easy to forget to unpersist cached data, which can break things unexpectedly or take up more memory than intended.

To solve these problems we've added withCached function

withSpark {
    dsOf(1, 2, 3, 4, 5)
            .map { it to (it + 2) }
            .withCached {
                showDS()

                filter { it.first % 2 == 0 }.showDS()
            }
            .map { c(it.first, it.second, (it.first + it.second) * 2) }
            .show()
}

Here we're showing cached Dataset for debugging purposes then filtering it. The filter method returns filtered Dataset and then the cached Dataset is being unpersisted, so we have more memory t o call the map method and collect the resulting Dataset.

toList and toArray methods

For more idiomatic Kotlin code we've added toList and toArray methods in this API. You can still use the collect method as in Scala API, however the result should be casted to Array. This is because collect returns a Scala array, which is not the same as Java/Kotlin one.

Examples

For more, check out examples module. To get up and running quickly, check out this tutorial.

Reporting issues/Support

Please use GitHub issues for filing feature requests and bug reports. You are also welcome to join kotlin-spark channel in the Kotlin Slack.

Code of Conduct

This project and the corresponding community is governed by the JetBrains Open Source and Community Code of Conduct. Please make sure you read it.

License

Kotlin for Apache Spark is licensed under the Apache 2.0 License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].