Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to Spark 3 #302

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 31 additions & 41 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.lucidworks.spark</groupId>
<artifactId>spark-solr</artifactId>
<version>3.9.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>spark-solr</name>
<description>Tools for reading data from Spark into Solr</description>
Expand Down Expand Up @@ -36,14 +36,14 @@
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<spark.version>2.4.5</spark.version>
<java.version>11</java.version>
<spark.version>3.0.0</spark.version>
<solr.version>8.4.1</solr.version>
<hadoop.version>2.7.5</hadoop.version>
<fasterxml.version>2.10.1</fasterxml.version>
<scala.version>2.11.12</scala.version>
<scala.binary.version>2.11</scala.binary.version>
<scoverage.plugin.version>1.1.1</scoverage.plugin.version>
<fasterxml.version>2.11.0</fasterxml.version>
<scala.version>2.12.10</scala.version>
<scala.binary.version>2.12</scala.binary.version>
<scoverage.plugin.version>1.4.1</scoverage.plugin.version>
<MaxPermSize>128m</MaxPermSize>
</properties>
<pluginRepositories>
Expand Down Expand Up @@ -78,7 +78,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -98,7 +98,7 @@
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
Expand All @@ -121,7 +121,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
<version>0.8.5</version>
<configuration>
<excludes>
<exclude>com/lucidworks/spark/example/**</exclude>
Expand Down Expand Up @@ -156,9 +156,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<argLine>${argLine} -XX:MaxPermSize=${MaxPermSize}</argLine>
</configuration>
</plugin>
</plugins>
</build>
Expand All @@ -169,7 +166,7 @@
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.2</version>
<version>4.4.0</version>
<executions>
<execution>
<id>eclipse-add-source</id>
Expand Down Expand Up @@ -213,7 +210,7 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
Expand All @@ -222,16 +219,13 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.3</version>
<version>2.7</version>
</plugin>
<!-- Surefire runs Java tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<argLine> -XX:MaxPermSize=${MaxPermSize}</argLine>
</configuration>
<version>2.22.2</version>
</plugin>
<!-- ScalaTest runs Scala tests -->
<plugin>
Expand Down Expand Up @@ -262,7 +256,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
Expand Down Expand Up @@ -372,7 +366,7 @@
<relocation>
<pattern>org.apache.http</pattern>
<shadedPattern>shaded.apache.http</shadedPattern>
</relocation>
</relocation>
</relocations>
</configuration>
</execution>
Expand Down Expand Up @@ -446,7 +440,7 @@
<dependency>
<groupId>com.esotericsoftware</groupId>
<artifactId>kryo-shaded</artifactId>
<version>3.0.3</version>
<version>4.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand All @@ -460,20 +454,15 @@
<artifactId>spark-mllib_${scala.binary.version}</artifactId>
<version>${spark.version}</version>
</dependency>
<dependency>
<groupId>org.apache.bahir</groupId>
<artifactId>spark-streaming-twitter_${scala.binary.version}</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.3.1</version>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.apache.solr</groupId>
Expand Down Expand Up @@ -594,12 +583,12 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
<version>3.9</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -639,7 +628,7 @@
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_${scala.binary.version}</artifactId>
<version>3.0.3</version>
<version>3.0.8</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -650,19 +639,20 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.19</version>
<version>1.20</version>
</dependency>
<dependency> <!-- optional dependency of joda-time that is mandatory in Scala -->
<!-- optional dependency of joda-time that is mandatory in Scala -->
<!--
<dependency>
<groupId>org.joda</groupId>
<artifactId>joda-convert</artifactId>
<version>1.2</version>
<version>2.2.1</version>
</dependency>
-->
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock</artifactId>
<version>1.56</version>
<!-- Include everything below here if you have dependency conflicts -->
<classifier>standalone</classifier>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-standalone</artifactId>
<version>2.26.3</version>
<exclusions>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
Expand Down
10 changes: 1 addition & 9 deletions src/main/java/com/lucidworks/spark/SparkApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import com.lucidworks.spark.example.hadoop.Logs2SolrRDDProcessor;
import com.lucidworks.spark.example.query.KMeansAnomaly;
import com.lucidworks.spark.example.query.*;
import com.lucidworks.spark.example.streaming.DocumentFilteringStreamProcessor;
import com.lucidworks.spark.example.streaming.TwitterToSolrStreamProcessor;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.GnuParser;
Expand Down Expand Up @@ -241,14 +239,10 @@ private static RDDProcessor newProcessor(String streamProcType) throws Exception

streamProcType = streamProcType.trim();

if ("twitter-to-solr".equals(streamProcType))
return new TwitterToSolrStreamProcessor();
else if ("word-count".equals(streamProcType))
if ("word-count".equals(streamProcType))
return new WordCount();
else if ("term-vectors".equals(streamProcType))
return new ReadTermVectors();
else if ("docfilter".equals(streamProcType))
return new DocumentFilteringStreamProcessor();
else if ("hdfs-to-solr".equals(streamProcType))
return new HdfsToSolrRDDProcessor();
else if ("logs2solr".equals(streamProcType))
Expand Down Expand Up @@ -278,10 +272,8 @@ else if ("eventsim".equals(streamProcType))

private static void displayProcessorOptions(PrintStream out) throws Exception {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("twitter-to-solr", getProcessorOptions(new TwitterToSolrStreamProcessor()));
formatter.printHelp("word-count", getProcessorOptions(new WordCount()));
formatter.printHelp("term-vectors", getProcessorOptions(new ReadTermVectors()));
formatter.printHelp("docfilter", getProcessorOptions(new DocumentFilteringStreamProcessor()));
formatter.printHelp("hdfs-to-solr", getProcessorOptions(new HdfsToSolrRDDProcessor()));
formatter.printHelp("logs2solr", getProcessorOptions(new Logs2SolrRDDProcessor()));
formatter.printHelp("query-solr-benchmark", getProcessorOptions(new QueryBenchmark()));
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/lucidworks/spark/example/ml/MLPipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ public int run(SparkConf conf, CommandLine cli) throws Exception {
System.out.println(confusionMatrix);

// compute the false positive rate per label
System.out.println();
System.out.println("F-Measure: "+metrics.fMeasure());

System.out.println("Accuracy: "+metrics.accuracy());
System.out.println("label\tfpr\n");

String[] labels = labelConverter.getLabels();
Expand Down
Loading