dongjoon-hyun commented on code in PR #60709:
URL: https://github.com/apache/spark/pull/60709#discussion_r4633875439


##########
sql/core/src/test/scala/org/apache/spark/sql/CharVarcharTestSuite.scala:
##########
@@ -85,10 +85,14 @@ trait CharVarcharTestSuite extends QueryTest {
   }
 
   def assertLengthCheckFailure(func: () => Unit): Unit = {
+    assertLengthCheckFailure(func, limit = 5)
+  }
+
+  def assertLengthCheckFailure(func: () => Unit, limit: Int): Unit = {

Review Comment:
   **[1] Could the two `func` overloads be one method with `limit: Int = 5`?**
   
   Gluten's `GlutenCharVarcharTestSuite` [overrides the one-argument 
`assertLengthCheckFailure(func: () => 
Unit)`](https://github.com/apache/gluten/blob/2823b55d0ac2b02568532aba8828e775e74e284c/gluten-ut/spark42/src/test/scala/org/apache/spark/sql/GlutenCharVarcharTestSuite.scala#L28-L43).
 With this PR, the three read-side checks call the two-argument overload 
instead, so that override never sees them. The override still compiles, and 
under Gluten those three checks run Spark's `intercept[SparkRuntimeException]`. 
To cover every check, Gluten first has to notice that the two-argument overload 
is now the one to override.
   
   With a single method that has a default, the old one-argument override no 
longer compiles (`method assertLengthCheckFailure overrides nothing`), so the 
change is caught at compile time. It also removes a method that only forwards 
`limit = 5`. Only one overload may define defaults, and 
`assertLengthCheckFailure(query: String)` has none, so this is allowed:
   
   ```suggestion
     def assertLengthCheckFailure(func: () => Unit, limit: Int = 5): Unit = {
   ```
   
   I checked both points with scalac 2.13.18 on a small copy of these 
overloads. Every call shape in this suite (a SQL string, `() => ...`, and `() 
=> ..., limit = 2`) resolves as before, and a subclass that overrides the 
one-argument signature fails with that error.



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

Reply via email to