Skip to content

Commit

Permalink
Remove the unnecessary parameter dataType in resolveColumnVector meth…
Browse files Browse the repository at this point in the history
…od (#4340)

Signed-off-by: Firestarman <firestarmanllc@gmail.com>
  • Loading branch information
firestarman authored Dec 10, 2021
1 parent 1588f6a commit f99a57b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class GpuExpandIterator(
val (cv, nullColumnReused) = expr.columnarEval(cb) match {
case null => getOrCreateNullCV(sparkType)
case other =>
(GpuExpressionsUtils.resolveColumnVector(other, cb.numRows, sparkType), false)
(GpuExpressionsUtils.resolveColumnVector(other, cb.numRows), false)
}
if (!nullColumnReused) {
uniqueDeviceColumns += cv
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import com.nvidia.spark.rapids.shims.v2.{ShimBinaryExpression, ShimExpression, S
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.expressions._
import org.apache.spark.sql.catalyst.expressions.codegen.{CodegenContext, ExprCode}
import org.apache.spark.sql.types.{DataType, StringType}
import org.apache.spark.sql.types.StringType
import org.apache.spark.sql.vectorized.ColumnarBatch
import org.apache.spark.unsafe.types.UTF8String

Expand Down Expand Up @@ -64,15 +64,14 @@ object GpuExpressionsUtils extends Arm {
* should cover all the cases for GPU pipelines.
*
* @param any the input value. It will be closed if it is a closeable after the call done.
* @param numRows the expected row number of the output column, used when 'any' is a Scalar.
* @param dType the data type of the output column, used when 'any' is a Scalar.
* @param numRows the expected row number of the output column, used when 'any' is a GpuScalar.
* @return a `GpuColumnVector` if it succeeds. Users should close the column vector to avoid
* memory leak.
*/
def resolveColumnVector(any: Any, numRows: Int, dType: DataType): GpuColumnVector = {
def resolveColumnVector(any: Any, numRows: Int): GpuColumnVector = {
withResourceIfAllowed(any) {
case c: GpuColumnVector => c.incRefCount()
case s: GpuScalar => GpuColumnVector.from(s, numRows, dType)
case s: GpuScalar => GpuColumnVector.from(s, numRows, s.dataType)
case other =>
throw new IllegalArgumentException(s"Cannot resolve a ColumnVector from the value:" +
s" $other. Please convert it to a GpuScalar or a GpuColumnVector before returning.")
Expand All @@ -91,7 +90,7 @@ object GpuExpressionsUtils extends Arm {
* memory leak.
*/
def columnarEvalToColumn(expr: Expression, batch: ColumnarBatch): GpuColumnVector =
resolveColumnVector(expr.columnarEval(batch), batch.numRows, expr.dataType)
resolveColumnVector(expr.columnarEval(batch), batch.numRows)

/**
* Extract the GpuLiteral
Expand Down

0 comments on commit f99a57b

Please sign in to comment.