You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "beliefer (via GitHub)" <gi...@apache.org> on 2023/11/08 06:59:38 UTC

[PR] [WIP][SPARK-45832][SQL] Fix `Super method + is deprecated.` [spark]

beliefer opened a new pull request, #43713:
URL: https://github.com/apache/spark/pull/43713

   ### What changes were proposed in this pull request?
   AttributeMap extends scala.Map. but the `+` has been deprecated in scala 2.13.
   ```
     @deprecated("Consider requiring an immutable Map or fall back to Map.concat.", "2.13.0")
     def + [V1 >: V](kv: (K, V1)): CC[K, V1] =
       mapFactory.from(new View.Appended(this, kv))
   ```
   Then the compiler warnings `Super method + is deprecated.` occurs.
   
   ### Why are the changes needed?
   Fix `Super method + is deprecated.`
   
   
   ### Does this PR introduce _any_ user-facing change?
   'No'.
   
   
   ### How was this patch tested?
   Manual test.
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   'No'.
   


-- 
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] [WIP][SPARK-45832][SQL] Fix `Super method + is deprecated.` [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on PR #43713:
URL: https://github.com/apache/spark/pull/43713#issuecomment-1801713714

   cc @panbingkun 


-- 
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] [SPARK-45832][SQL] Fix `Super method + is deprecated.` [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on PR #43713:
URL: https://github.com/apache/spark/pull/43713#issuecomment-1807752127

   should we close this one ?


-- 
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] [SPARK-45832][SQL] Fix `Super method + is deprecated.` [spark]

Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on PR #43713:
URL: https://github.com/apache/spark/pull/43713#issuecomment-1803099217

   hmm...  if scalac doesn't report this warning, my personal suggestion is to leave it unfixed. The inheritance hierarchy is as follows:
   
   `AttributeMap` <- `immutable.Map` <- `immutable.MapOps` <- `collection.MapOps`
   
   Although the `+` of `collection.MapOps` is marked as deprecated, the `+` of `immutable.MapOps` does not appear to be deprecated.
   
   ```scala
     /**
       * Alias for `updated`
       *
       * @param kv the key/value pair.
       * @tparam V1 the type of the value in the key/value pair.
       * @return A new map with the new binding added to this map.
       */
     override def + [V1 >: V](kv: (K, V1)): CC[K, V1] = updated(kv._1, kv._2)
   ```


-- 
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] [SPARK-45832][SQL] Fix `Super method + is deprecated.` [spark]

Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on PR #43713:
URL: https://github.com/apache/spark/pull/43713#issuecomment-1803076916

   A strange and interesting phenomenon is that:
   when I add `"-Wconf:cat=deprecation&msg=Super method:e"` to `SparkBuild`, then run `./build/sbt "catalyst/testOnly"`, no error was triggered, but I did see `deprecated prompt` in `IntelliJ`. 
   Is it a `false alarm`?


-- 
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] [SPARK-45832][SQL] Fix `Super method + is deprecated.` [spark]

Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer closed pull request #43713: [SPARK-45832][SQL] Fix `Super method + is deprecated.`
URL: https://github.com/apache/spark/pull/43713


-- 
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] [SPARK-45832][SQL] Fix `Super method + is deprecated.` [spark]

Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #43713:
URL: https://github.com/apache/spark/pull/43713#discussion_r1387391412


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveLateralColumnAliasReference.scala:
##########
@@ -170,7 +170,8 @@ object ResolveLateralColumnAliasReference extends Rule[LogicalPlan] {
           case (a: Alias, idx) =>
             val lcaResolved = unwrapLCAReference(a)
             // Insert the original alias instead of rewritten one to detect chained LCA
-            aliasMap += (a.toAttribute -> AliasEntry(a, idx))
+            aliasMap =
+              AttributeMap(aliasMap.baseMap.values.toMap + (a.toAttribute -> AliasEntry(a, idx)))

Review Comment:
   ```suggestion
                 aliasMap ++= AttributeMap(Map(a.toAttribute -> AliasEntry(a, idx)))
   ```



-- 
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] [SPARK-45832][SQL] Fix `Super method + is deprecated.` [spark]

Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #43713:
URL: https://github.com/apache/spark/pull/43713#discussion_r1387392114


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveLateralColumnAliasReference.scala:
##########
@@ -170,7 +170,8 @@ object ResolveLateralColumnAliasReference extends Rule[LogicalPlan] {
           case (a: Alias, idx) =>
             val lcaResolved = unwrapLCAReference(a)
             // Insert the original alias instead of rewritten one to detect chained LCA
-            aliasMap += (a.toAttribute -> AliasEntry(a, idx))
+            aliasMap =
+              AttributeMap(aliasMap.baseMap.values.toMap + (a.toAttribute -> AliasEntry(a, idx)))

Review Comment:
   Maybe so that we can hide access to internal values as much as possible.



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveLateralColumnAliasReference.scala:
##########
@@ -170,7 +170,8 @@ object ResolveLateralColumnAliasReference extends Rule[LogicalPlan] {
           case (a: Alias, idx) =>
             val lcaResolved = unwrapLCAReference(a)
             // Insert the original alias instead of rewritten one to detect chained LCA
-            aliasMap += (a.toAttribute -> AliasEntry(a, idx))
+            aliasMap =
+              AttributeMap(aliasMap.baseMap.values.toMap + (a.toAttribute -> AliasEntry(a, idx)))

Review Comment:
   Maybe so that we can hide access to `internal values` as much as possible.



-- 
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] [SPARK-45832][SQL] Fix `Super method + is deprecated.` [spark]

Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on PR #43713:
URL: https://github.com/apache/spark/pull/43713#issuecomment-1803089169

   Yes. this warning appeared in `IntelliJ`.


-- 
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] [SPARK-45832][SQL] Fix `Super method + is deprecated.` [spark]

Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #43713:
URL: https://github.com/apache/spark/pull/43713#discussion_r1387405692


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveLateralColumnAliasReference.scala:
##########
@@ -170,7 +170,8 @@ object ResolveLateralColumnAliasReference extends Rule[LogicalPlan] {
           case (a: Alias, idx) =>
             val lcaResolved = unwrapLCAReference(a)
             // Insert the original alias instead of rewritten one to detect chained LCA
-            aliasMap += (a.toAttribute -> AliasEntry(a, idx))
+            aliasMap =
+              AttributeMap(aliasMap.baseMap.values.toMap + (a.toAttribute -> AliasEntry(a, idx)))

Review Comment:
   Sounds good. But it seems created extra AttributeMap.
   How about `aliasMap = AttributeMap(aliasMap.updated(a.toAttribute, AliasEntry(a, idx)))`?



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveLateralColumnAliasReference.scala:
##########
@@ -170,7 +170,8 @@ object ResolveLateralColumnAliasReference extends Rule[LogicalPlan] {
           case (a: Alias, idx) =>
             val lcaResolved = unwrapLCAReference(a)
             // Insert the original alias instead of rewritten one to detect chained LCA
-            aliasMap += (a.toAttribute -> AliasEntry(a, idx))
+            aliasMap =
+              AttributeMap(aliasMap.baseMap.values.toMap + (a.toAttribute -> AliasEntry(a, idx)))

Review Comment:
   Sounds good. But it seems created extra `AttributeMap`.
   How about `aliasMap = AttributeMap(aliasMap.updated(a.toAttribute, AliasEntry(a, idx)))`?



-- 
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] [SPARK-45832][SQL] Fix `Super method + is deprecated.` [spark]

Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on PR #43713:
URL: https://github.com/apache/spark/pull/43713#issuecomment-1803122782

   I checked the  inheritance hierarchy too. I agree @LuciferYang 's suggestion, fix it later.


-- 
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