Skip to content

Commit

Permalink
Fix crash on scalar only orderby (NVIDIA#889)
Browse files Browse the repository at this point in the history
Signed-off-by: Robert (Bobby) Evans <bobby@apache.org>
  • Loading branch information
revans2 authored Sep 30, 2020
1 parent a102872 commit 6b6a039
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,20 @@

package com.nvidia.spark.rapids

import scala.collection.mutable.ArrayBuffer

import ai.rapids.cudf.{BinaryOp, BinaryOperable, DType, Scalar, UnaryOp}
import com.nvidia.spark.rapids.RapidsPluginImplicits._

import org.apache.spark.sql.catalyst.expressions.{BinaryExpression, BinaryOperator, ComplexTypeMergingExpression, Expression, String2TrimExpression, TernaryExpression, UnaryExpression, Unevaluable}
import org.apache.spark.sql.catalyst.expressions._
import org.apache.spark.sql.types.StringType
import org.apache.spark.sql.vectorized.ColumnarBatch
import org.apache.spark.unsafe.types.UTF8String

object GpuExpressionsUtils extends Arm {
def evaluateBoundExpressions[A <: GpuExpression](cb: ColumnarBatch,
boundExprs: Seq[A]): Seq[GpuColumnVector] = {
val numCols = boundExprs.length
closeOnExcept(new ArrayBuffer[GpuColumnVector](numCols)) { resultCvs =>
for (i <- 0 until numCols) {
val ref = boundExprs(i)
resultCvs += ref.columnarEval(cb).asInstanceOf[GpuColumnVector]
}
resultCvs
withResource(GpuProjectExec.project(cb, boundExprs)) { cb =>
(0 until cb.numCols()).map(cb.column(_).asInstanceOf[GpuColumnVector].incRefCount())
.toArray.toSeq
}
}

Expand Down

0 comments on commit 6b6a039

Please sign in to comment.