spark-wordcount/README.md

26 lines
824 B
Markdown
Raw Normal View History

2020-06-21 10:07:17 -04:00
# Spark Word Count with Unit Tests
This is a project detailing how to write word count program in Apache Spark along with unit test cases. The related blog post can be found at [https://www.barrelsofdata.com/spark-word-count-with-unit-tests](https://www.barrelsofdata.com/spark-word-count-with-unit-tests)
2020-06-21 10:03:19 -04:00
## Build instructions
From the root of the project execute the below commands
- To clear all compiled classes, build and log directories
```shell script
./gradlew clean
```
- To run tests
```shell script
./gradlew test
```
- To build jar
```shell script
./gradlew shadowJar
```
- All combined
```shell script
./gradlew clean test shadowJar
```
## Run
```shell script
2020-06-21 10:07:17 -04:00
spark-submit --master yarn --deploy-mode cluster build/libs/spark-wordcount-1.0.jar hdfs://path/to/input/file.txt hdfs://path/to/output/directory
2020-06-21 10:03:19 -04:00
```