Skip to content

Commit

Permalink
add default case to match
Browse files Browse the repository at this point in the history
  • Loading branch information
kiszk committed Aug 6, 2018
1 parent 64ad7b8 commit 9cc0c60
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ object ScalaReflection extends ScalaReflection {
def attributesFor[T: TypeTag]: Seq[Attribute] = schemaFor[T] match {
case Schema(s: StructType, _) =>
s.toAttributes
case _ => throw new RuntimeException(s"$schemaFor is not supported at attributesFor()")
}

/** Returns a catalyst DataType and its nullability for the given Scala Type using reflection. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ case class ApproxCountDistinctForIntervals(
(endpointsExpression.dataType, endpointsExpression.eval()) match {
case (ArrayType(elementType, _), arrayData: ArrayData) =>
arrayData.toObjectArray(elementType).map(_.toString.toDouble)
case _ => throw new RuntimeException("not found at endpoints")
}

override def checkInputDataTypes(): TypeCheckResult = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ class CodegenContext {
case NewFunctionSpec(functionName, None, None) => functionName
case NewFunctionSpec(functionName, Some(_), Some(innerClassInstance)) =>
innerClassInstance + "." + functionName
case _ => null // nothing to do since addNewFunctionInteral() must return one of them
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ object ValueInterval {
false
case (n1: NumericValueInterval, n2: NumericValueInterval) =>
n1.min.compareTo(n2.max) <= 0 && n1.max.compareTo(n2.min) >= 0
case _ => throw new RuntimeException(s"Not supported pair: $r1, $r2 at isIntersected()")
}

/**
Expand All @@ -86,6 +87,7 @@ object ValueInterval {
val newMax = if (n1.max <= n2.max) n1.max else n2.max
(Some(EstimationUtils.fromDouble(newMin, dt)),
Some(EstimationUtils.fromDouble(newMax, dt)))
case _ => throw new RuntimeException(s"Not supported pair: $r1, $r2 at intersect()")
}
}
}

0 comments on commit 9cc0c60

Please sign in to comment.