Skip to content

Commit

Permalink
Move Support for RaiseError to a Shim Excluding Spark 4.0.0 [databr…
Browse files Browse the repository at this point in the history
…icks] (#10970)

* Incomplete impl of RaiseError for 400

* Removed RaiseError from 400

* Signing off

Signed-off-by: Raza Jafri <[email protected]>

---------

Signed-off-by: Raza Jafri <[email protected]>
  • Loading branch information
razajafri authored Jun 4, 2024
1 parent 4707406 commit 3111e2b
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3797,14 +3797,6 @@ object GpuOverrides extends Logging {
TypeSig.ARRAY.nested(TypeSig.all)),
(e, conf, p, r) => new GpuGetArrayStructFieldsMeta(e, conf, p, r)
),
expr[RaiseError](
"Throw an exception",
ExprChecks.unaryProject(
TypeSig.NULL, TypeSig.NULL,
TypeSig.STRING, TypeSig.STRING),
(a, conf, p, r) => new UnaryExprMeta[RaiseError](a, conf, p, r) {
override def convertToGpu(child: Expression): GpuExpression = GpuRaiseError(child)
}),
expr[DynamicPruningExpression](
"Dynamic pruning expression marker",
ExprChecks.unaryProject(TypeSig.all, TypeSig.all, TypeSig.BOOLEAN, TypeSig.BOOLEAN),
Expand All @@ -3820,7 +3812,8 @@ object GpuOverrides extends Logging {
val expressions: Map[Class[_ <: Expression], ExprRule[_ <: Expression]] =
commonExpressions ++ TimeStamp.getExprs ++ GpuHiveOverrides.exprs ++
ZOrderRules.exprs ++ DecimalArithmeticOverrides.exprs ++
BloomFilterShims.exprs ++ InSubqueryShims.exprs ++ SparkShimImpl.getExprs
BloomFilterShims.exprs ++ InSubqueryShims.exprs ++ RaiseErrorShim.exprs ++
SparkShimImpl.getExprs

def wrapScan[INPUT <: Scan](
scan: INPUT,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright (c) 2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*** spark-rapids-shim-json-lines
{"spark": "311"}
{"spark": "312"}
{"spark": "313"}
{"spark": "320"}
{"spark": "321"}
{"spark": "321cdh"}
{"spark": "322"}
{"spark": "323"}
{"spark": "324"}
{"spark": "330"}
{"spark": "330cdh"}
{"spark": "330db"}
{"spark": "331"}
{"spark": "332"}
{"spark": "332cdh"}
{"spark": "332db"}
{"spark": "333"}
{"spark": "334"}
{"spark": "340"}
{"spark": "341"}
{"spark": "341db"}
{"spark": "342"}
{"spark": "343"}
{"spark": "350"}
{"spark": "351"}
spark-rapids-shim-json-lines ***/
package com.nvidia.spark.rapids.shims

import com.nvidia.spark.rapids.{ExprRule, GpuOverrides}
import com.nvidia.spark.rapids.{ExprChecks, GpuExpression, TypeSig, UnaryExprMeta}

import org.apache.spark.sql.catalyst.expressions.{Expression, RaiseError}
import org.apache.spark.sql.rapids.shims.GpuRaiseError

object RaiseErrorShim {
val exprs: Map[Class[_ <: Expression], ExprRule[_ <: Expression]] = {
Seq(GpuOverrides.expr[RaiseError](
"Throw an exception",
ExprChecks.unaryProject(
TypeSig.NULL, TypeSig.NULL,
TypeSig.STRING, TypeSig.STRING),
(a, conf, p, r) => new UnaryExprMeta[RaiseError](a, conf, p, r) {
override def convertToGpu(child: Expression): GpuExpression = GpuRaiseError(child)
})).map(r => (r.getClassFor.asSubclass(classOf[Expression]), r)).toMap
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,36 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*** spark-rapids-shim-json-lines
{"spark": "311"}
{"spark": "312"}
{"spark": "313"}
{"spark": "320"}
{"spark": "321"}
{"spark": "321cdh"}
{"spark": "322"}
{"spark": "323"}
{"spark": "324"}
{"spark": "330"}
{"spark": "330cdh"}
{"spark": "330db"}
{"spark": "331"}
{"spark": "332"}
{"spark": "332cdh"}
{"spark": "332db"}
{"spark": "333"}
{"spark": "334"}
{"spark": "340"}
{"spark": "341"}
{"spark": "341db"}
{"spark": "342"}
{"spark": "343"}
{"spark": "350"}
{"spark": "351"}
spark-rapids-shim-json-lines ***/
package org.apache.spark.sql.rapids.shims

package org.apache.spark.sql.rapids

import ai.rapids.cudf.{ColumnVector}
import ai.rapids.cudf.ColumnVector
import com.nvidia.spark.rapids.{GpuColumnVector, GpuUnaryExpression}
import com.nvidia.spark.rapids.Arm.withResource

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*** spark-rapids-shim-json-lines
{"spark": "400"}
spark-rapids-shim-json-lines ***/
package com.nvidia.spark.rapids.shims

import com.nvidia.spark.rapids.{ExprRule, GpuOverrides}
import com.nvidia.spark.rapids.{ExprChecks, GpuExpression, TypeSig, UnaryExprMeta}

import org.apache.spark.sql.catalyst.expressions.{Expression, RaiseError}

object RaiseErrorShim {
val exprs: Map[Class[_ <: Expression], ExprRule[_ <: Expression]] = Map.empty
}

0 comments on commit 3111e2b

Please sign in to comment.