Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RAPIDS-accelerated Hive UDFs support all types #1551

Merged
merged 2 commits into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
56 changes: 28 additions & 28 deletions docs/supported_ops.md
Original file line number Diff line number Diff line change
Expand Up @@ -16588,13 +16588,13 @@ Accelerator support is described below.
<td>S</td>
<td>S*</td>
<td>S</td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td>S*</td>
<td>S</td>
<td>S</td>
<td>S</td>
<td><em>PS* (missing nested UDT)</em></td>
<td><em>PS* (missing nested UDT)</em></td>
<td><em>PS* (missing nested UDT)</em></td>
<td><b>NS</b></td>
</tr>
<tr>
Expand All @@ -16609,13 +16609,13 @@ Accelerator support is described below.
<td>S</td>
<td>S*</td>
<td>S</td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td><em>PS* (missing nested DECIMAL, NULL, BINARY, CALENDAR, ARRAY, MAP, STRUCT, UDT)</em></td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td>S*</td>
<td>S</td>
<td>S</td>
<td>S</td>
<td><em>PS* (missing nested UDT)</em></td>
<td><em>PS* (missing nested UDT)</em></td>
<td><em>PS* (missing nested UDT)</em></td>
<td><b>NS</b></td>
</tr>
<tr>
Expand Down Expand Up @@ -16678,13 +16678,13 @@ Accelerator support is described below.
<td>S</td>
<td>S*</td>
<td>S</td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td>S*</td>
<td>S</td>
<td>S</td>
<td>S</td>
<td><em>PS* (missing nested UDT)</em></td>
<td><em>PS* (missing nested UDT)</em></td>
<td><em>PS* (missing nested UDT)</em></td>
<td><b>NS</b></td>
</tr>
<tr>
Expand All @@ -16699,13 +16699,13 @@ Accelerator support is described below.
<td>S</td>
<td>S*</td>
<td>S</td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td><em>PS* (missing nested DECIMAL, NULL, BINARY, CALENDAR, ARRAY, MAP, STRUCT, UDT)</em></td>
<td><b>NS</b></td>
<td><b>NS</b></td>
<td>S*</td>
<td>S</td>
<td>S</td>
<td>S</td>
<td><em>PS* (missing nested UDT)</em></td>
<td><em>PS* (missing nested UDT)</em></td>
<td><em>PS* (missing nested UDT)</em></td>
<td><b>NS</b></td>
</tr>
<tr>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, NVIDIA CORPORATION.
* Copyright (c) 2020-2021, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,6 +23,10 @@ import org.apache.spark.sql.catalyst.expressions.Expression
import org.apache.spark.sql.hive.{HiveGenericUDF, HiveSimpleUDF}

object GpuHiveOverrides {
// UDFs can support all types except UDT which does not have a clear columnar representation.
private val udfTypeSig = (TypeSig.commonCudfTypes + TypeSig.DECIMAL + TypeSig.NULL +
TypeSig.BINARY + TypeSig.CALENDAR + TypeSig.ARRAY + TypeSig.MAP + TypeSig.STRUCT).nested()

def isSparkHiveAvailable: Boolean = {
// Using the same approach as SparkSession.hiveClassesArePresent
val loader = Thread.currentThread().getContextClassLoader
Expand All @@ -48,12 +52,9 @@ object GpuHiveOverrides {
GpuOverrides.expr[HiveSimpleUDF](
"Hive UDF, support requires the UDF to implement a RAPIDS-accelerated interface",
ExprChecks.projectNotLambda(
TypeSig.commonCudfTypes + TypeSig.ARRAY.nested(TypeSig.commonCudfTypes),
udfTypeSig,
TypeSig.all,
revans2 marked this conversation as resolved.
Show resolved Hide resolved
repeatingParamCheck = Some(RepeatingParamCheck(
"param",
TypeSig.commonCudfTypes,
TypeSig.all))),
repeatingParamCheck = Some(RepeatingParamCheck("param", udfTypeSig, TypeSig.all))),
(a, conf, p, r) => new ExprMeta[HiveSimpleUDF](a, conf, p, r) {
override def tagExprForGpu(): Unit = {
a.function match {
Expand All @@ -79,12 +80,9 @@ object GpuHiveOverrides {
"Hive Generic UDF, support requires the UDF to implement a " +
"RAPIDS-accelerated interface",
ExprChecks.projectNotLambda(
TypeSig.commonCudfTypes + TypeSig.ARRAY.nested(TypeSig.commonCudfTypes),
udfTypeSig,
TypeSig.all,
repeatingParamCheck = Some(RepeatingParamCheck(
"param",
TypeSig.commonCudfTypes,
TypeSig.all))),
repeatingParamCheck = Some(RepeatingParamCheck("param", udfTypeSig, TypeSig.all))),
(a, conf, p, r) => new ExprMeta[HiveGenericUDF](a, conf, p, r) {
override def tagExprForGpu(): Unit = {
a.function match {
Expand Down