Code Monkey home page Code Monkey logo

spark-job's Introduction

Spark Job Demo

Compiled in run on JDK 8.

How to run Spark

Example 1: The famous WordCounter

spark-submit --class com.broodcamp.spark.WordCounter --master local target/spark-job-0.0.1-SNAPSHOT.jar src/main/resources/input.txt

*Now let's try to run Spark by processing data from https://grouplens.org/datasets/movielens/100k/.

Example 2: Compute the average rating given by a user

UserId MovieId Rating TimeStamp

196 242 3 881250949

spark-submit --class com.broodcamp.spark.RatingsAverage --master local target/spark-job-0.0.1-SNAPSHOT.jar src/main/resources/u.data

Example 3: Old five-star movies

Example 4: Most rated one-star movies

spark-submit --class com.broodcamp.spark.WorstMovies --master local target/spark-job-0.0.1-SNAPSHOT.jar src/main/resources/u.data src/main/resources/u.item

spark-submit --class com.broodcamp.spark.WorstMoviesV2 --master local target/spark-job-0.0.1-SNAPSHOT.jar src/main/resources/u.data src/main/resources/u.item

Example 5: Get the square of each element in the set

spark-submit --class com.broodcamp.spark.NumberSquare --master local target/spark-job-0.0.1-SNAPSHOT.jar

Example 6. Movie recommendation

spark-submit --class com.broodcamp.spark.MovieRecommendationsALS --master local target/spark-job-0.0.1-SNAPSHOT.jar src/main/resources/u-ml.data src/main/resources/u.item

spark-submit --class com.broodcamp.spark.MovieRecommendationsALS2 --master local target/spark-job-0.0.1-SNAPSHOT.jar src/main/resources/sample_movielens_ratings.txt src/main/resources/u.item

Example 6. Cassandra integration

spark-submit --class com.broodcamp.spark.CassandraIntegration --packages com.datastax.spark:spark-cassandra-connector_2.11:2.4.0 --master local target/spark-job-0.0.1-SNAPSHOT.jar src/main/resources/u.user

Example 7. MongoDB integration

spark-submit --class com.broodcamp.spark.MongoIntegration --packages org.mongodb.spark:mongo-spark-connector_2.11:2.4.0 --master local target/spark-job-0.0.1-SNAPSHOT.jar src/main/resources/u.user

spark-job's People

Contributors

czetsuya avatar

Watchers

 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.