GithubHelp home page GithubHelp logo

friends's Introduction

Friends app

A big data homework.

Task

Input: one or more text files with lines with the following structure:

<name>, <money>, <friend1>, <friend2>, ... , <friendk>

<name> is unique across the whole dataset - imagine e.g. usernames. <money> is a non-negative integer - how much money does the person have. <friend1> ... <friendk> is a set of friends that the given user has. Each user can have a different number of friends. If user A has a friend B, it does not imply that B has a friend A.

Output: username of the user with most wealthy friends. It means the user where the sum of money of his friends is the biggest among all the users. The money of the user himself is not counted, only of his friends.

The size of the input is so big that the code must run on a cluster of machines. Imagine the size of the Facebook user database.

Example

Input:

david, 10, petr, josef, andrea
andrea, 50, josef, martin
petr, 20, david, josef
josef, 5, andrea, petr, david
martin, 100, josef, andrea, david

Output:

andrea

Build

Friends app is a maven project.

Build the app and run unit tests by:

mvn clean package

Run

Submit to secure remote cluster

Before submitting to remote yarn cluster, obtain a Kerberos TGT and make sure spark submit can access hadoop configuration (export HADOOP_CONF_DIR if needed).

kinit -kt /etc/security/keytabs/hbase.headless.keytab hbase-dr-cluster 
spark-submit --master yarn-cluster --conf spark.hadoop.yarn.timeline-service.enabled=false --class tkuthan.FriendsApp friends-0.0.1-SNAPSHOT.jar /user/hbase/friends.csv

The output is written to standard output. In cluster mode, it can be obtained from yarn logs:

yarn logs -applicationId <appId>

Run locally

spark-submit --class tkuthan.FriendsApp target/friends-0.0.1-SNAPSHOT.jar data/friends.csv

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.