Skip to content

Day 9 / Apr 14 (Thu)

Back to Scala with a bit of Spark SQL.

The following is a list of exercises to help you hone your skills in Scala (with some Spark SQL). You are supposed to do the exercises alone. In the end, push your projects to Github.

There is no ordering. There is no need to do them all. You can pick whatever exercises you like in any order.

Use slack to ask questions. You can DM me directly or use #scala-academy channel. Up to your liking.

Enjoy!

Exercises

These exercises are about Spark SQL.

  1. Selecting the most important rows per assigned priority
  2. Exercise: Reverse-engineering Dataset.show Output
  3. Exercise: Specifying Table and SQL Query on Command Line

Scala Project: Node

Write a class Node that can have zero, one or more Node children. The class should support adding a child Node, removing and listing them.

The most challenging part is display method that should display a Node with all children (that in turn may have Node children that are supposed to be displayed, too).

A sample display could look like the following:

AdaptiveSparkPlan
+- Union
   :- HashAggregate_1
   :  +- Exchange
   :     +- HashAggregate
   :        +- Project
   :           +- Range
   +- HashAggregate_2
      +- Exchange
         +- HashAggregate
            +- Project
               +- Range

The above shows a Node (called AdaptiveSparkPlan) with one child (Union) that has two children HashAggregate_1 and HashAggregate_2 and so on.

Write unit tests.

Project Euler

  1. Multiples of 3 or 5
  2. Even Fibonacci numbers

Reddit

  1. Additive Persistence
  2. Making change
  3. The Havel-Hakimi algorithm for graph realization
  4. Print a new number by adding one to each of its digit
  5. The Game of Blobs
Back to top