concept Java in category graphx

appears as: Java, Java
Spark GraphX in Action

This is an excerpt from Manning's book Spark GraphX in Action.

Although this book uses Scala primarily, don’t worry if you don’t know Scala yet. Chapter 3 provides a jumpstart into Scala, and all along the way we explain the tricks and terse, arcane syntax that are part and parcel of Scala. But deep familiarity with at least one programming language—such as Java, C++, C#, or Python—is assumed.

Although Scala is the native language of Spark, there are various reasons why one may want to use one of the other languages supported by Spark: personal preference, team or corporate preference, security, compatibility with preferred libraries, to name a few. As of the Spark 1.6 release, it’s possible to use GraphX with Java 7 and Java 8, but there are no APIs provided for Python or R, and the APIs for Java are not easy to use. A true Java-friendly API for GraphX is the subject of Jira ticket SPARK-3665, which is not targeted for a particular release (as of Spark 1.6). There are several reasons why you might want to use Java with GraphX, but ease of use is not one of them. If you’re considering using Java with GraphX because you’re more familiar with Java than Scala, you’ll want to rethink that decision. You have to write ten times as much code for Java as for Scala, a lot of it with obscure constructs. Plus, there is no REPL that comes with Java.

There are two other reasons to use Java that might make sense:

10.1.1. Using GraphX with Java 7

In this section, we take the edge count example from section 4.2.3 and convert it to Java. Because Java doesn’t come with a REPL, we need a pom.xml file for Maven, and we start with that.