From 4f77c87de1461522516af9a9942d4c447ffd8bc1 Mon Sep 17 00:00:00 2001 From: "Robert (Bobby) Evans" Date: Mon, 23 Nov 2020 15:37:17 -0600 Subject: [PATCH] Enable NullType for First and Last in 3.0.1+ (#1189) Signed-off-by: Robert (Bobby) Evans --- .../spark/rapids/shims/spark301/Spark301Shims.scala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/shims/spark301/src/main/scala/com/nvidia/spark/rapids/shims/spark301/Spark301Shims.scala b/shims/spark301/src/main/scala/com/nvidia/spark/rapids/shims/spark301/Spark301Shims.scala index 1d301841ae3..55cc8ec8ee1 100644 --- a/shims/spark301/src/main/scala/com/nvidia/spark/rapids/shims/spark301/Spark301Shims.scala +++ b/shims/spark301/src/main/scala/com/nvidia/spark/rapids/shims/spark301/Spark301Shims.scala @@ -31,6 +31,7 @@ import org.apache.spark.sql.execution.adaptive.ShuffleQueryStageExec import org.apache.spark.sql.execution.exchange.{BroadcastExchangeLike, ShuffleExchangeLike} import org.apache.spark.sql.execution.joins.{BroadcastHashJoinExec, ShuffledHashJoinExec, SortMergeJoinExec} import org.apache.spark.sql.rapids.execution.{GpuBroadcastExchangeExecBase, GpuShuffleExchangeExecBase} +import org.apache.spark.sql.types.DataType import org.apache.spark.storage.{BlockId, BlockManagerId} class Spark301Shims extends Spark300Shims { @@ -55,12 +56,20 @@ class Spark301Shims extends Spark300Shims { GpuOverrides.expr[First]( "first aggregate operator", (a, conf, p, r) => new ExprMeta[First](a, conf, p, r) { + override def isSupportedType(t: DataType): Boolean = + GpuOverrides.isSupportedType(t, + allowNull = true) + override def convertToGpu(): GpuExpression = GpuFirst(childExprs(0).convertToGpu(), a.ignoreNulls) }), GpuOverrides.expr[Last]( "last aggregate operator", (a, conf, p, r) => new ExprMeta[Last](a, conf, p, r) { + override def isSupportedType(t: DataType): Boolean = + GpuOverrides.isSupportedType(t, + allowNull = true) + override def convertToGpu(): GpuExpression = GpuLast(childExprs(0).convertToGpu(), a.ignoreNulls) })