You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "HyukjinKwon (via GitHub)" <gi...@apache.org> on 2024/08/23 02:18:42 UTC
Re: [PR] [SPARK-49352][SQL] Avoid redundant array transform for identical expression [spark]
HyukjinKwon commented on code in PR #47843:
URL: https://github.com/apache/spark/pull/47843#discussion_r1728157166
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TableOutputResolver.scala:
##########
@@ -413,8 +413,14 @@ object TableOutputResolver extends SQLConfHelper with Logging {
resolveColumnsByPosition(tableName, Seq(param), Seq(fakeAttr), conf, addError, colPath)
}
if (res.length == 1) {
- val func = LambdaFunction(res.head, Seq(param))
- Some(Alias(ArrayTransform(nullCheckedInput, func), expected.name)())
+ if (res.head == param) {
+ // If the element type is the same, we can reuse the input array directly.
+ Some(Alias(nullCheckedInput, expected.name)
+ (nonInheritableMetadataKeys = Seq(CharVarcharUtils.CHAR_VARCHAR_TYPE_STRING_METADATA_KEY)))
Review Comment:
nit
```suggestion
Some(
Alias(nullCheckedInput, expected.name)(
nonInheritableMetadataKeys = Seq(CharVarcharUtils.CHAR_VARCHAR_TYPE_STRING_METADATA_KEY)))
```
--
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