Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zhli1142015 committed Mar 20, 2024
1 parent 9fb3e36 commit eeed575
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ class SparkPlanExecApiImpl extends SparkPlanExecApi {
override def genUuidTransformer(
substraitExprName: String,
original: Uuid): ExpressionTransformer = {
UuidTransformer(substraitExprName, original)
GenericExpressionTransformer(
substraitExprName,
Seq(LiteralTransformer(Literal(original.randomSeed.get))),
original)
}

/** Transform map_entries to Substrait. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,18 +240,3 @@ case class GetArrayStructFieldsTransformer(
ExpressionBuilder.makeScalarFunction(functionId, inputNodes, typeNode)
}
}

case class UuidTransformer(substraitExprName: String, original: Uuid)
extends ExpressionTransformer {

override def doTransform(args: java.lang.Object): ExpressionNode = {
val functionMap = args.asInstanceOf[java.util.HashMap[String, java.lang.Long]]
val functionId = ExpressionBuilder.newScalarFunction(
functionMap,
ConverterUtils.makeFuncName(substraitExprName, Seq(LongType)))
val seed = Literal(original.randomSeed.get)
val inputNodes = Lists.newArrayList[ExpressionNode](LiteralTransformer(seed).doTransform(args))
val typeNode = ConverterUtils.getTypeNode(original.dataType, original.nullable)
ExpressionBuilder.makeScalarFunction(functionId, inputNodes, typeNode)
}
}

0 comments on commit eeed575

Please sign in to comment.