Skip to content

Commit 8feae96

Browse files
authored
Merge pull request #259 from marklogic/feature/java8-compat
Removed scala-java8-compat
2 parents bd1d544 + d237680 commit 8feae96

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

build.gradle

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,6 @@ dependencies {
5757
// Need this so that an OkHttpClientConfigurator can be created.
5858
shadowDependencies 'com.squareup.okhttp3:okhttp:4.12.0'
5959

60-
// Makes it possible to use lambdas in Java 8 to implement Spark's Function1 and Function2 interfaces
61-
// See https://github.com/scala/scala-java8-compat for more information
62-
shadowDependencies("org.scala-lang.modules:scala-java8-compat_2.12:1.0.2") {
63-
// Prefer the Scala libraries used within the user's Spark runtime.
64-
exclude module: "scala-library"
65-
}
66-
6760
shadowDependencies ("org.apache.jena:jena-arq:4.10.0") {
6861
exclude group: "com.fasterxml.jackson.core"
6962
exclude group: "com.fasterxml.jackson.dataformat"

src/main/java/com/marklogic/spark/reader/JsonRowDeserializer.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import scala.Function2;
1414
import scala.collection.JavaConverters;
1515
import scala.collection.Seq;
16-
import scala.compat.java8.JFunction;
1716

1817
import java.util.ArrayList;
1918

@@ -33,17 +32,10 @@ public class JsonRowDeserializer {
3332
private final Function2<JsonFactory, String, JsonParser> jsonParserCreator;
3433
private final Function1<String, UTF8String> utf8StringCreator;
3534

36-
// Ignoring warnings about JFunction.func until an alternative can be found.
37-
@SuppressWarnings("java:S1874")
3835
public JsonRowDeserializer(StructType schema) {
3936
this.jacksonParser = newJacksonParser(schema);
40-
41-
// Used https://github.com/scala/scala-java8-compat in the DHF Spark 2 connector. Per the README for
42-
// scala-java8-compat, we should be able to use scala.jdk.FunctionConverters since those are part of Scala
43-
// 2.13. However, that is not yet working within PySpark. So sticking with this "legacy" approach as it seems
44-
// to work fine in both vanilla Spark (i.e. JUnit tests) and PySpark.
45-
this.jsonParserCreator = JFunction.func(CreateJacksonParser::string);
46-
this.utf8StringCreator = JFunction.func(UTF8String::fromString);
37+
this.jsonParserCreator = CreateJacksonParser::string;
38+
this.utf8StringCreator = UTF8String::fromString;
4739
}
4840

4941
public InternalRow deserializeJson(String json) {

0 commit comments

Comments
 (0)