cloud-fan commented on code in PR #49609:
URL: https://github.com/apache/spark/pull/49609#discussion_r1928165546
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/variant/variantExpressions.scala:
##########
@@ -287,31 +282,64 @@ case class VariantGet(
timeZoneId,
zoneId)
- protected override def nullSafeEval(input: Any, path: Any): Any = {
- VariantGet.variantGet(input.asInstanceOf[VariantVal], parsedPath,
dataType, castArgs)
+ protected override def nullSafeEval(input: Any, path: Any): Any = parsedPath
match {
+ case Some(pp) =>
+ VariantGet.variantGet(input.asInstanceOf[VariantVal], pp, dataType,
castArgs)
+ case _ =>
+ val pathValue = path.toString
+ val parsedRowPath = VariantGet.getParsedPath(pathValue, prettyName)
+ VariantGet.variantGet(input.asInstanceOf[VariantVal], parsedRowPath,
dataType, castArgs)
Review Comment:
to simply the codegen implementation, I think we should push more work to
the external functions instead of in the `eval` method.
How about we add an overload of `VariantGet.variantGet` that accepts the
path parameter as a `UTF8String`? The new overload will take care of the path
parsing and codegen just needs to call this overload.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]