You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "panbingkun (via GitHub)" <gi...@apache.org> on 2024/10/17 01:48:38 UTC
[PR] [Only For Test] Test StaticInvoke cast [spark]
panbingkun opened a new pull request, #48507:
URL: https://github.com/apache/spark/pull/48507
### What changes were proposed in this pull request?
### Why are the changes needed?
### Does this PR introduce _any_ user-facing change?
### How was this patch tested?
### Was this patch authored or co-authored using generative AI tooling?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [Only For Test] Test StaticInvoke cast [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #48507:
URL: https://github.com/apache/spark/pull/48507#discussion_r1806112839
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala:
##########
@@ -322,21 +322,22 @@ case class StaticInvoke(
val evaluate = if (returnNullable && !method.getReturnType.isPrimitive) {
if (CodeGenerator.defaultValue(dataType) == "null") {
s"""
- ${ev.value} = $callFunc;
+ ${ev.value} = ($javaType) $callFunc;
${ev.isNull} = ${ev.value} == null;
"""
} else {
val boxedResult = ctx.freshName("boxedResult")
+ val boxedJavaType = CodeGenerator.boxedType(dataType)
s"""
- ${CodeGenerator.boxedType(dataType)} $boxedResult = $callFunc;
+ $boxedJavaType $boxedResult = ($boxedJavaType) $callFunc;
Review Comment:
can we add a unit test (manually construct `StaticInvoke` expression to call a testing java function)?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [Only For Test] Test StaticInvoke cast [spark]
Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun closed pull request #48507: [Only For Test] Test StaticInvoke cast
URL: https://github.com/apache/spark/pull/48507
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [Only For Test] Test StaticInvoke cast [spark]
Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #48507:
URL: https://github.com/apache/spark/pull/48507#discussion_r1806309363
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala:
##########
@@ -322,21 +322,22 @@ case class StaticInvoke(
val evaluate = if (returnNullable && !method.getReturnType.isPrimitive) {
if (CodeGenerator.defaultValue(dataType) == "null") {
s"""
- ${ev.value} = $callFunc;
+ ${ev.value} = ($javaType) $callFunc;
${ev.isNull} = ${ev.value} == null;
"""
} else {
val boxedResult = ctx.freshName("boxedResult")
+ val boxedJavaType = CodeGenerator.boxedType(dataType)
s"""
- ${CodeGenerator.boxedType(dataType)} $boxedResult = $callFunc;
+ $boxedJavaType $boxedResult = ($boxedJavaType) $callFunc;
Review Comment:
yeah, thanks!
I have already done this feature in another PR, please review: https://github.com/apache/spark/pull/48542
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org