diff --git a/sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuOverrides.scala b/sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuOverrides.scala index 93fa2b9f2c0..9a1b1dfc2bb 100644 --- a/sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuOverrides.scala +++ b/sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuOverrides.scala @@ -3995,6 +3995,24 @@ object GpuOverrides extends Logging { // HyperLogLogPlusPlus supports all the types that Xxhash 64 supports Seq(ParamCheck("input",XxHash64Shims.supportedTypes, TypeSig.all))), (a, conf, p, r) => new UnaryExprMeta[HyperLogLogPlusPlus](a, conf, p, r) { + + // It's the same as Xxhash64 + override def tagExprForGpu(): Unit = { + val maxDepth = a.children.map( + c => XxHash64Utils.computeMaxStackSize(c.dataType)).max + if (maxDepth > Hash.MAX_STACK_DEPTH) { + willNotWorkOnGpu(s"The data type requires a stack depth of $maxDepth, " + + s"which exceeds the GPU limit of ${Hash.MAX_STACK_DEPTH}. " + + "The algorithm to calculate stack depth: " + + "1: Primitive type counts 1 depth; " + + "2: Array of Structure counts: 1 + depthOf(Structure); " + + "3: Array of Other counts: depthOf(Other); " + + "4: Structure counts: 1 + max of depthOf(child); " + + "5: Map counts: 2 + max(depthOf(key), depthOf(value)); " + ) + } + } + override def convertToGpu(child: Expression): GpuExpression = { GpuHyperLogLogPlusPlus(child, a.relativeSD) }