Giter VIP home page Giter VIP logo

scala-s3-odd-grouping's Introduction

Scala Multiple Odds Keys

Application reads multiple CSV or TSV files in the same directory handling their extensions particularities. Group By the key and value in all file sources and counting them, keeping only those with Odd count. After that Writes all content in a new TSV file.

Usage

Test Application:

sbt test

Run with SBT:

sbt run 
    --input | -i {S3_INPUT_PATH:'s3a://bucket/input'}
    --output | -o {S3_OUTPUT_PATH:'s3a://bucket/output'}
    --aws-profile | -a {AWS_PROFILE:default}

Submit application:

spark-submit --master {yarn/local/spark:HOST:PORT} --class com.vigil.VigilGeneralDataEngineerApp {JAR_PATH} \ 
    --input | -i {S3_INPUT_PATH:'s3a://bucket/input'}
    --output | -o {S3_OUTPUT_PATH:'s3a://bucket/output'}
    --aws-profile | -a {AWS_PROFILE:default}

Execution Discussions

It was developed two approaches for the exercise. Firstly I started with DataFrame API, and after I reimplemented with RDD API:

VigilGeneralDataEngineerApp.executeWithDataFrameAPI @ 32:

alt text

  • This approach executes in one Stage
  • And executes with all optimization of Catalyst
  • Processed in 0.9 seconds on my local machine*

VigilGeneralDataEngineerApp.executeWithRDDAPI @ 54:

alt text

  • This other approach execute with two Stages, because off reduceByKey (which is better than groupByKey)
  • And executed in 0.6 seconds on my local machine*

*These times are not that relevant because the files sizes are too small

TODO

  • Create SparkSession by Environment

scala-s3-odd-grouping's People

Contributors

lucassantiag avatar

Watchers

James Cloos 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.