You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "imarkowitz (via GitHub)" <gi...@apache.org> on 2025/09/30 02:12:04 UTC

[PR] [SPARK-53507][CORE] Use Java class for BreakingChangeInfo [spark]

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

   ### What changes were proposed in this pull request?
   
   Use Java class instead of Scala case class for BreakingChangeInfo and MitigationConfig
   
   
   ### Why are the changes needed?
   
   Per comment: https://github.com/apache/spark/pull/52256#discussion_r2378561779
   
   > [cloud-fan](https://github.com/cloud-fan) [5 days ago](https://github.com/apache/spark/pull/52256#discussion_r2378561779)
   > I just realize that we expose it as a public API via SparkThrowable.getBreakingChangeInfo. We shouldn't expose a case class as public API as it has a wide API surface, including the companion object.
   > We should follow SparkThrowable and define it in Java.
   
   
   ### Does this PR introduce _any_ user-facing change?
   
   No -- interface is almost the same
   
   
   ### How was this patch tested?
   
   Updated unit tests
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Used Github co-pilot, mainly for the `equals` and `hashCode` functions


-- 
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-53507][CORE] Don't use case class for BreakingChangeInfo [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #52484:
URL: https://github.com/apache/spark/pull/52484#discussion_r2415553648


##########
common/utils/src/main/scala/org/apache/spark/ErrorClassesJSONReader.scala:
##########
@@ -203,18 +203,48 @@ private case class ErrorSubInfo(
  *                       If false, the spark job should be retried by setting the
  *                       mitigationConfig.
  */
-case class BreakingChangeInfo(
-    migrationMessage: Seq[String],
-    mitigationConfig: Option[MitigationConfig] = None,
-    needsAudit: Boolean = true
-)
+class BreakingChangeInfo(
+  val migrationMessage: Seq[String],
+  val mitigationConfig: Option[MitigationConfig] = None,
+  val needsAudit: Boolean = true) {

Review Comment:
   ```suggestion
       val migrationMessage: Seq[String],
       val mitigationConfig: Option[MitigationConfig] = None,
       val needsAudit: Boolean = true) {
   ```



-- 
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-53507][CORE] Use Java class for BreakingChangeInfo [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #52484:
URL: https://github.com/apache/spark/pull/52484#discussion_r2391341358


##########
common/utils/src/main/java/org/apache/spark/MitigationConfig.java:
##########
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark;
+
+public class MitigationConfig {

Review Comment:
   we can use java record to simplify it.



-- 
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-53507][CORE] Don't use case class for BreakingChangeInfo [spark]

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

   thanks, merging to master!


-- 
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-53507][CORE] Use Java class for BreakingChangeInfo [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #52484:
URL: https://github.com/apache/spark/pull/52484#discussion_r2391341358


##########
common/utils/src/main/java/org/apache/spark/MitigationConfig.java:
##########
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark;
+
+public class MitigationConfig {

Review Comment:
   we can just java record to simplify it.



-- 
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-53507][CORE] Don't use case class for BreakingChangeInfo [spark]

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

   Is it possible that `BreakingChange` will require more than one `MitigationConfig`? While currently there is one to one mapping, in the future can it require more than one? Also, should `MitigationConfig` be inner class of `BreakingChangeInfo`?  Are there any use case for `MitigationConfig` that is not part of `BreakingChangeInfo`?


-- 
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-53507][CORE] Don't use case class for BreakingChangeInfo [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan closed pull request #52484: [SPARK-53507][CORE] Don't use case class for BreakingChangeInfo
URL: https://github.com/apache/spark/pull/52484


-- 
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-53507][CORE] Don't use case class for BreakingChangeInfo [spark]

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

   @vrozov Having more than one mitigation configs is hard to use and we should ask people to avoid it when making breaking changes. I don't have a strong opinion about making `MitigationConfig` an inner class, the Spark codebase does not use inner class that much even if it's doable in many places (e.g. `CatalogTable` stuff).


-- 
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-53507][CORE] Don't use case class for BreakingChangeInfo [spark]

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


##########
common/utils/src/main/java/org/apache/spark/MitigationConfig.java:
##########
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark;
+
+public class MitigationConfig {

Review Comment:
   Rewrote to use Scala still, but not a case class



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