Giter VIP home page Giter VIP logo

spark-custom-api's Introduction

Custom API Examples For Apache Spark

Build Status codecov.io

The examples are basic and only for newbies in Scala and Spark.

Motivation

There are a lot of developers who love Spark and want to have custom APIs for Spark. For example, a Spark integration with another software or simple customized APIs, which can be modulized and used frequently as a thrid-party library. For those guys, here are some custom API examples in this library. This can be imported by a jar as a third-party with Spark.

Custom APIs in this library

  • customPipe(..) equivalent to pipe(..) in RDD

    import com.company.spark.custom._
    
    val rdd = sc.parallelize(Seq(1, 2, 3))
    rdd.customPipe("cat").collect()
  • customCount() equivalent to count() in DataFrame

    import com.company.spark.custom._
    
    val data = Seq(1, 2, 3, 4, 5)
    val rdd = sc.parallelize(numList)
    val df = numRDD.toDF
    df.customCount()
  • customTextFile(..) equivalent to textFile(..) in SparkContext

    import com.company.spark.custom._
    
    val path = "path-to-file"
    sc.customTextFile(path)
  • customLoadJsonRDD(..) equivalent to jsonRDD(..) in SQLContext

    import com.company.spark.custom._
    
    val jsonRDD = sparkContext.parallelize(
      """{"a": 1}""" ::
      """{"a": 2}""" :: Nil)
    sqlContext.customLoadJsonRDD(jsonRDD)

Test

  • For test in your local, just run below:

    ./dev/run-tests
    

Building From Source

This library is built with SBT, which is automatically downloaded by the included shell script. To build a JAR file simply run sbt/sbt package from the project root. The build configuration includes support for both Scala 2.10 and 2.11.

spark-custom-api's People

Contributors

hyukjinkwon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.