Skip to content

Commit 3ba42be

Browse files
authored
Scala 2.13 preparations - part 1 (#5700)
1 parent b43305f commit 3ba42be

30 files changed

+55
-49
lines changed

api-generation/src/main/scala/ai/h2o/sparkling/api/generation/common/MetricResolver.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ trait MetricResolver {
3030
val (swFieldName, swMetricName) = MetricNameConverter.convertFromH2OToSW(field.getName)
3131
Metric(swFieldName, swMetricName, field.getName, field.getType, field.getAnnotation(classOf[API]).help())
3232
}
33-
parameters
33+
parameters.toSeq
3434
}
3535
}

core/src/main/scala/ai/h2o/sparkling/H2OColumnType.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
package ai.h2o.sparkling
1919

2020
object H2OColumnType extends Enumeration {
21-
val enum, string, int, real, time, uuid = Value
21+
val `enum`, string, int, real, time, uuid = Value
2222

2323
def fromString(dataType: String): Value = {
2424
values.find(_.toString == dataType).getOrElse(throw new RuntimeException(s"Unknown H2O's Data type $dataType"))

core/src/main/scala/ai/h2o/sparkling/H2OContext.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class H2OContext private[sparkling] (private val conf: H2OConf) extends H2OConte
123123
cloudV3.compiled_on)
124124
val h2oClusterInfo = H2OClusterInfo(
125125
s"$flowIp:$flowPort",
126-
visibleFlowURL,
126+
visibleFlowURL(),
127127
cloudV3.cloud_healthy,
128128
cloudV3.internal_security_enabled,
129129
nodes.map(_.ipPort()),
@@ -305,7 +305,7 @@ class H2OContext private[sparkling] (private val conf: H2OConf) extends H2OConte
305305
| ${nodes.mkString("\n ")}
306306
| ------------------------
307307
|
308-
| Open H2O Flow in browser: ${getFlowUIHint}
308+
| Open H2O Flow in browser: ${getFlowUIHint()}
309309
|
310310
""".stripMargin
311311
val sparkYarnAppId = if (sparkContext.master.toLowerCase.startsWith("yarn")) {
@@ -475,8 +475,8 @@ object H2OContext extends Logging {
475475

476476
private def logStartingInfo(conf: H2OConf): Unit = {
477477
logInfo("Sparkling Water version: " + BuildInfo.SWVersion)
478-
val unsupportedSuffix = if (getFirstUnsupportedSWVersion.isDefined) " (unsupported)" else ""
479-
val deprecationSuffix = if (isSparkVersionDeprecated) " (deprecated)" else ""
478+
val unsupportedSuffix = if (getFirstUnsupportedSWVersion().isDefined) " (unsupported)" else ""
479+
val deprecationSuffix = if (isSparkVersionDeprecated()) " (deprecated)" else ""
480480
logInfo("Spark version: " + SparkSessionUtils.active.version + unsupportedSuffix + deprecationSuffix)
481481
logInfo("Integrated H2O version: " + BuildInfo.H2OVersion)
482482
logInfo("The following Spark configuration is used: \n " + conf.getAll.mkString("\n "))
@@ -502,7 +502,7 @@ object H2OContext extends Logging {
502502
s"Apache Spark ${SparkSessionUtils.active.version} is unsupported" +
503503
s"since the Sparkling Water version ${unsupportedSWVersion.get}.")
504504
}
505-
if (isSparkVersionDeprecated) {
505+
if (isSparkVersionDeprecated()) {
506506
logWarning(
507507
s"Apache Spark ${SparkSessionUtils.active.version} is deprecated and " +
508508
"the support will be removed in the Sparkling Water version 3.44.")

core/src/main/scala/ai/h2o/sparkling/H2OFrame.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class H2OFrame private (
151151
this
152152
} else {
153153
val endpoint = getClusterEndpoint(conf)
154-
val colIndices = columns.map(columnNames.indexOf)
154+
val colIndices = columns.map(col => columnNames.indexOf(col))
155155
val newFrameId = s"${frameId}_subframe_${colIndices.mkString("_")}"
156156
val params = Map(
157157
"ast" -> MessageFormat.format(s"( assign {0} (cols {1} {2}))", newFrameId, frameId, stringifyArray(colIndices)))

core/src/main/scala/ai/h2o/sparkling/SparklingWaterDriver.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import org.apache.spark.SparkConf
2727
object SparklingWaterDriver {
2828

2929
/** Entry point */
30-
def main(args: Array[String]) {
30+
def main(args: Array[String]): Unit = {
3131
// Configure this application
3232
val conf: SparkConf = H2OConf.checkSparkConf(
3333
new SparkConf()

core/src/main/scala/ai/h2o/sparkling/backend/H2ODataFrame.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private[backend] class H2ODataFrame(val frame: H2OFrame, val requiredColumns: Ar
5151
if (requiredColumns == null) {
5252
colNames.indices.toArray
5353
} else {
54-
requiredColumns.map(colNames.indexOf)
54+
requiredColumns.map(col => colNames.indexOf(col))
5555
}
5656
}
5757

core/src/main/scala/ai/h2o/sparkling/backend/H2ORDD.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private[backend] class H2ORDD[A <: Product: TypeTag: ClassTag](val frame: H2OFra
9292
private def columnReaders(rcc: Reader) = {
9393
val readerMapByName = (rcc.OptionReaders ++ rcc.SimpleReaders).map {
9494
case (supportedType, reader) => supportedType.name -> reader
95-
}
95+
}.toMap
9696
productType.memberTypeNames.map(name => readerMapByName(name))
9797
}
9898

core/src/main/scala/ai/h2o/sparkling/backend/converters/SupportedDataset.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ private[this] object SupportedDataset {
162162
override def toH2OFrame(hc: H2OContext, frameKeyName: Option[String]): H2OFrame = {
163163
val spark = SparkSessionUtils.active
164164
import spark.implicits._
165-
SparkDataFrameConverter.toH2OFrame(hc, dataset.map(v => Tuple1(v)).toDF, frameKeyName)
165+
SparkDataFrameConverter.toH2OFrame(hc, dataset.map(v => Tuple1(v)).toDF(), frameKeyName)
166166
}
167167
}
168168

@@ -171,7 +171,7 @@ private[this] object SupportedDataset {
171171
override def toH2OFrame(hc: H2OContext, frameKeyName: Option[String]): H2OFrame = {
172172
val spark = SparkSessionUtils.active
173173
import spark.implicits._
174-
SparkDataFrameConverter.toH2OFrame(hc, dataset.map(v => Tuple1(v)).toDF, frameKeyName)
174+
SparkDataFrameConverter.toH2OFrame(hc, dataset.map(v => Tuple1(v)).toDF(), frameKeyName)
175175
}
176176
}
177177
}

core/src/main/scala/ai/h2o/sparkling/backend/converters/SupportedRDD.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,15 @@ private[this] object SupportedRDD {
191191
override def toH2OFrame(hc: H2OContext, frameKeyName: Option[String]): H2OFrame = {
192192
val spark = SparkSessionUtils.active
193193
import spark.implicits._
194-
SparkDataFrameConverter.toH2OFrame(hc, rdd.map(v => Tuple1(v)).toDF, frameKeyName)
194+
SparkDataFrameConverter.toH2OFrame(hc, rdd.map(v => Tuple1(v)).toDF(), frameKeyName)
195195
}
196196
}
197197

198198
implicit def toH2OFrameFromRDDMLlibVector(rdd: RDD[mllib.linalg.Vector]): SupportedRDD = new SupportedRDD {
199199
override def toH2OFrame(hc: H2OContext, frameKeyName: Option[String]): H2OFrame = {
200200
val spark = SparkSessionUtils.active
201201
import spark.implicits._
202-
SparkDataFrameConverter.toH2OFrame(hc, rdd.map(v => Tuple1(v)).toDF, frameKeyName)
202+
SparkDataFrameConverter.toH2OFrame(hc, rdd.map(v => Tuple1(v)).toDF(), frameKeyName)
203203
}
204204
}
205205
}

core/src/main/scala/ai/h2o/sparkling/backend/external/ExternalBackendConf.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ trait ExternalBackendConf extends SharedBackendConf with Logging with ExternalBa
188188

189189
def setExternalExtraJars(commaSeparatedPaths: String): H2OConf = set(PROP_EXTERNAL_EXTRA_JARS._1, commaSeparatedPaths)
190190

191-
def setExternalExtraJars(paths: java.util.ArrayList[String]): H2OConf = setExternalExtraJars(paths.asScala)
191+
def setExternalExtraJars(paths: java.util.ArrayList[String]): H2OConf = setExternalExtraJars(paths.asScala.toList)
192192

193193
def setExternalExtraJars(paths: Seq[String]): H2OConf = setExternalExtraJars(paths.mkString(","))
194194

0 commit comments

Comments
 (0)