Github user ueshin commented on a diff in the pull request:
https://github.com/apache/spark/pull/22044#discussion_r208873100
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala
---
@@ -3442,17 +3464,15 @@ case class ArrayDistinct(child: Expression)
}
override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
- nullSafeCodeGen(ctx, ev, (array) => {
- val i = ctx.freshName("i")
- val j = ctx.freshName("j")
- val sizeOfDistinctArray = ctx.freshName("sizeOfDistinctArray")
- val getValue1 = CodeGenerator.getValue(array, elementType, i)
- val getValue2 = CodeGenerator.getValue(array, elementType, j)
- val foundNullElement = ctx.freshName("foundNullElement")
- val openHashSet = classOf[OpenHashSet[_]].getName
- val hs = ctx.freshName("hs")
- val classTag = s"scala.reflect.ClassTag$$.MODULE$$.Object()"
- if (elementTypeSupportEquals) {
+ if (canUseSpecializedHashSet) {
+ nullSafeCodeGen(ctx, ev, (array) => {
+ val i = ctx.freshName("i")
+ val sizeOfDistinctArray = ctx.freshName("sizeOfDistinctArray")
+ val foundNullElement = ctx.freshName("foundNullElement")
+ val openHashSet = classOf[OpenHashSet[_]].getName
+ val hs = ctx.freshName("hs")
+ val classTag = s"scala.reflect.ClassTag$$.MODULE$$.$hsTypeName()"
+ val getValue1 = CodeGenerator.getValue(array, elementType, i)
--- End diff --
nit: `val getValue`?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]