Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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 @@ -709,6 +709,8 @@ object ScalaReflection extends ScalaReflection {
def attributesFor[T: TypeTag]: Seq[Attribute] = schemaFor[T] match {
case Schema(s: StructType, _) =>
s.toAttributes
case others =>
throw new UnsupportedOperationException(s"Attributes for type $others is not supported")
}

/** 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 @@ -63,11 +63,11 @@ case class ApproxCountDistinctForIntervals(
}

// Mark as lazy so that endpointsExpression is not evaluated during tree transformation.
lazy val endpoints: Array[Double] =
(endpointsExpression.dataType, endpointsExpression.eval()) match {
case (ArrayType(elementType, _), arrayData: ArrayData) =>
arrayData.toObjectArray(elementType).map(_.toString.toDouble)
}
lazy val endpoints: Array[Double] = {
val endpointsType = endpointsExpression.dataType.asInstanceOf[ArrayType]
val endpoints = endpointsExpression.eval().asInstanceOf[ArrayData]
endpoints.toObjectArray(endpointsType.elementType).map(_.toString.toDouble)
}

override def checkInputDataTypes(): TypeCheckResult = {
val defaultCheck = super.checkInputDataTypes()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ class CodegenContext {
case NewFunctionSpec(functionName, None, None) => functionName
case NewFunctionSpec(functionName, Some(_), Some(innerClassInstance)) =>
innerClassInstance + "." + functionName
case _ =>
throw new IllegalArgumentException(s"$funcName is not matched at addNewFunction")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ object GenerateUnsafeProjection extends CodeGenerator[Seq[Expression], UnsafePro
// For top level row writer, it always writes to the beginning of the global buffer holder,
// which means its fixed-size region always in the same position, so we don't need to call
// `reset` to set up its fixed-size region every time.
if (inputs.map(_.isNull).forall(_ == "false")) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@kiszk was this intentional?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sorry, I made a mistake...

if (inputs.map(_.isNull).forall(_ == FalseLiteral)) {
// If all fields are not nullable, which means the null bits never changes, then we don't
// need to clear it out every time.
""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ object ValueInterval {
false
case (n1: NumericValueInterval, n2: NumericValueInterval) =>
n1.min.compareTo(n2.max) <= 0 && n1.max.compareTo(n2.min) >= 0
case _ =>
throw new UnsupportedOperationException(s"Not supported pair: $r1, $r2 at isIntersected()")
}

/**
Expand All @@ -86,6 +88,8 @@ 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 UnsupportedOperationException(s"Not supported pair: $r1, $r2 at intersect()")
}
}
}