This is an automated email from the ASF dual-hosted git repository.
gengliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 56c691caf05 [SPARK-42146][CORE] Refactor `Utils#setStringField` to
make maven build pass when sql module use this method
56c691caf05 is described below
commit 56c691caf05f84572f54939720e199e494af3d78
Author: yangjie01 <[email protected]>
AuthorDate: Sat Jan 21 19:45:18 2023 -0800
[SPARK-42146][CORE] Refactor `Utils#setStringField` to make maven build
pass when sql module use this method
### What changes were proposed in this pull request?
This pr aims refactor input parameter type of `Utils#setStringField`
function to make maven build pass when sql module use this functions.
### Why are the changes needed?
Make maven build pass when sql module use `Utils#setStringField` function
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
- Pass GitHub Actions
- Manual test:
Add the following code to sql module:
```scala
package org.apache.spark.status.protobuf.sql
import org.apache.spark.SparkFunSuite
import org.apache.spark.status.protobuf.StoreTypes
import org.apache.spark.status.protobuf.Utils.setStringField
class UtilsSuite extends SparkFunSuite {
test("maven build") {
val builder = StoreTypes.SQLExecutionUIData.newBuilder()
setStringField("1", builder.setDetails)
}
}
```
run `mvn clean install -DskipTests -pl sql/core -am`
**Before**
```
[ERROR] [Error]
/${basedir}/sql/core/src/test/scala/org/apache/spark/status/protobuf/sql/UtilsSuite.scala:27:
type mismatch;
found :
org.apache.spark.status.protobuf.StoreTypes.SQLExecutionUIData.Builder
required: com.google.protobuf.MessageOrBuilder
[ERROR] one error found
```
**After**
BUILD SUCCESS
Closes #39688 from LuciferYang/SPARK-42146.
Authored-by: yangjie01 <[email protected]>
Signed-off-by: Gengliang Wang <[email protected]>
---
core/src/main/scala/org/apache/spark/status/protobuf/Utils.scala | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/core/src/main/scala/org/apache/spark/status/protobuf/Utils.scala
b/core/src/main/scala/org/apache/spark/status/protobuf/Utils.scala
index 47e280f4ee9..809f9647d72 100644
--- a/core/src/main/scala/org/apache/spark/status/protobuf/Utils.scala
+++ b/core/src/main/scala/org/apache/spark/status/protobuf/Utils.scala
@@ -17,8 +17,6 @@
package org.apache.spark.status.protobuf
-import com.google.protobuf.MessageOrBuilder
-
object Utils {
def getOptional[T](condition: Boolean, result: () => T): Option[T] = if
(condition) {
Some(result())
@@ -26,7 +24,7 @@ object Utils {
None
}
- def setStringField(input: String, f: String => MessageOrBuilder): Unit = {
+ def setStringField(input: String, f: String => Any): Unit = {
if (input != null) {
f(input)
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]