Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class StopWordsRemoverSuite extends MLTest with DefaultReadWriteTest {
remover.transform(df)
.select("filtered1", "expected1", "filtered2", "expected2")
.collect().foreach {
case Row(r1: Seq[String], e1: Seq[String], r2: Seq[String], e2: Seq[String]) =>
case Row(r1: Seq[_], e1: Seq[_], r2: Seq[_], e2: Seq[_]) =>
assert(r1 === e1,
s"The result value is not correct after bucketing. Expected $e1 but found $r1")
assert(r2 === e2,
Expand All @@ -268,7 +268,7 @@ class StopWordsRemoverSuite extends MLTest with DefaultReadWriteTest {
remover.transform(df)
.select("filtered1", "expected1", "filtered2", "expected2")
.collect().foreach {
case Row(r1: Seq[String], e1: Seq[String], r2: Seq[String], e2: Seq[String]) =>
case Row(r1: Seq[_], e1: Seq[_], r2: Seq[_], e2: Seq[_]) =>
assert(r1 === e1,
s"The result value is not correct after bucketing. Expected $e1 but found $r1")
assert(r2 === e2,
Expand Down
2 changes: 2 additions & 0 deletions mllib/src/test/scala/org/apache/spark/ml/util/MLTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ trait MLTest extends StreamTest with TempDirectory { self: Suite =>
val n = Attribute.fromStructField(dataframe.schema(colName)) match {
case binAttr: BinaryAttribute => Some(2)
case nomAttr: NominalAttribute => nomAttr.getNumValues
case unknown =>
throw new IllegalArgumentException(s"Attribute type: ${unknown.getClass.getName}")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    Warning:Warning:line (88)match may not be exhaustive.
It would fail on the following inputs: NumericAttribute(), UnresolvedAttribute
    val n = Attribute.fromStructField(dataframe.schema(colName)) match {

}
assert(n.isDefined && n.get === numValues,
s"the number of values obtained from schema should be $numValues, but got $n")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ case object FloatType extends FloatType {
}

trait FloatAsIfIntegral extends FloatIsConflicted with Integral[Float] {
def quot(x: Float, y: Float): Float = (BigDecimal(x) quot BigDecimal(y)).floatValue
def rem(x: Float, y: Float): Float = (BigDecimal(x) remainder BigDecimal(y)).floatValue
def quot(x: Float, y: Float): Float = {
(BigDecimal(x.toDouble) quot BigDecimal(y.toDouble)).floatValue
}
def rem(x: Float, y: Float): Float = {
(BigDecimal(x.toDouble) remainder BigDecimal(y.toDouble)).floatValue
}
}

object FloatAsIfIntegral extends FloatAsIfIntegral {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class AnalysisExternalCatalogSuite extends AnalysisTest with Matchers {
Alias(UnresolvedFunction("sum", Seq(UnresolvedAttribute("a")), isDistinct = false), "s")()
val plan = Project(Seq(func), testRelation)
analyzer.execute(plan)
verifyZeroInteractions(catalog)
verifyNoInteractions(catalog)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning:Warning:line (62)method verifyZeroInteractions in class Mockito is deprecated: see corresponding Javadoc for more information.
      verifyZeroInteractions(catalog)

}
}

Expand All @@ -73,7 +73,7 @@ class AnalysisExternalCatalogSuite extends AnalysisTest with Matchers {
ignoreIfExists = false)
reset(externCatalog)
catalog.functionExists(FunctionIdentifier("sum"))
verifyZeroInteractions(externCatalog)
verifyNoInteractions(externCatalog)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class CSVExprUtilsSuite extends SparkFunSuite {
// null character, expressed in Unicode literal syntax
("""\u0000""", Some("\u0000"), None),
// and specified directly
("\0", Some("\u0000"), None)
("\u0000", Some("\u0000"), None)
)

test("should correctly produce separator strings, or exceptions, from input") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package org.apache.spark.sql.catalyst.expressions
import java.sql.{Date, Timestamp}
import java.util.TimeZone

import scala.language.implicitConversions
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning:Warning:line (39)implicit conversion method stringToUTF8Str should be enabled
by making the implicit value scala.language.implicitConversions visible.
This can be achieved by adding the import clause 'import scala.language.implicitConversions'
or by setting the compiler option -language:implicitConversions.
See the Scaladoc for value scala.language.implicitConversions for a discussion
why the feature should be explicitly enabled.
  implicit def stringToUTF8Str(str: String): UTF8String = UTF8String.fromString(str)

import scala.util.Random

import org.apache.spark.SparkFunSuite
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import java.nio.charset.StandardCharsets
import java.time.{ZoneId, ZoneOffset}

import scala.collection.mutable.ArrayBuffer
import scala.language.implicitConversions

import org.apache.commons.codec.digest.DigestUtils
import org.scalatest.exceptions.TestFailedException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import java.sql.{Date, Timestamp}
import java.time.LocalDateTime
import java.util.concurrent.TimeUnit

import scala.language.implicitConversions

import org.apache.spark.sql.catalyst.FunctionIdentifier
import org.apache.spark.sql.catalyst.analysis.{UnresolvedAttribute, _}
import org.apache.spark.sql.catalyst.expressions._
Expand Down