You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2023/05/19 09:25:10 UTC
[spark] branch branch-3.4 updated: [SPARK-43589][SQL] Fix `cannotBroadcastTableOverMaxTableBytesError` to use `bytesToString`
This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch branch-3.4
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.4 by this push:
new 1db2f5c36b1 [SPARK-43589][SQL] Fix `cannotBroadcastTableOverMaxTableBytesError` to use `bytesToString`
1db2f5c36b1 is described below
commit 1db2f5c36b120c213432fc658c9fd24fc73cb45e
Author: Dongjoon Hyun <do...@apache.org>
AuthorDate: Fri May 19 02:20:38 2023 -0700
[SPARK-43589][SQL] Fix `cannotBroadcastTableOverMaxTableBytesError` to use `bytesToString`
This PR aims to fix `cannotBroadcastTableOverMaxTableBytesError` to use `bytesToString` instead of shift operations.
To avoid user confusion by giving more accurate values. For example, `maxBroadcastTableBytes` is 1GB and `dataSize` is `2GB - 1 byte`.
**BEFORE**
```
Cannot broadcast the table that is larger than 1GB: 1 GB.
```
**AFTER**
```
Cannot broadcast the table that is larger than 1024.0 MiB: 2048.0 MiB.
```
Yes, but only error message.
Pass the CIs with newly added test case.
Closes #41232 from dongjoon-hyun/SPARK-43589.
Authored-by: Dongjoon Hyun <do...@apache.org>
Signed-off-by: Dongjoon Hyun <do...@apache.org>
(cherry picked from commit 04759570395c99bc17961742733d06e19a917abd)
Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
core/src/main/resources/error/error-classes.json | 2 +-
.../org/apache/spark/sql/errors/QueryExecutionErrors.scala | 6 +++---
.../apache/spark/sql/errors/QueryExecutionErrorsSuite.scala | 11 +++++++++++
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/core/src/main/resources/error/error-classes.json b/core/src/main/resources/error/error-classes.json
index 5622a12e19e..febed9283d8 100644
--- a/core/src/main/resources/error/error-classes.json
+++ b/core/src/main/resources/error/error-classes.json
@@ -4790,7 +4790,7 @@
},
"_LEGACY_ERROR_TEMP_2249" : {
"message" : [
- "Cannot broadcast the table that is larger than <maxBroadcastTableBytes>GB: <dataSize> GB."
+ "Cannot broadcast the table that is larger than <maxBroadcastTableBytes>: <dataSize>."
]
},
"_LEGACY_ERROR_TEMP_2250" : {
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala
index 7ec9f41af36..8d79713dd0d 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala
@@ -53,7 +53,7 @@ import org.apache.spark.sql.streaming.OutputMode
import org.apache.spark.sql.types._
import org.apache.spark.unsafe.array.ByteArrayMethods
import org.apache.spark.unsafe.types.UTF8String
-import org.apache.spark.util.CircularBuffer
+import org.apache.spark.util.{CircularBuffer, Utils}
/**
* Object for grouping error messages from (most) exceptions thrown during query execution.
@@ -2361,8 +2361,8 @@ private[sql] object QueryExecutionErrors extends QueryErrorsBase {
new SparkException(
errorClass = "_LEGACY_ERROR_TEMP_2249",
messageParameters = Map(
- "maxBroadcastTableBytes" -> (maxBroadcastTableBytes >> 30).toString(),
- "dataSize" -> (dataSize >> 30).toString()),
+ "maxBroadcastTableBytes" -> Utils.bytesToString(maxBroadcastTableBytes),
+ "dataSize" -> Utils.bytesToString(dataSize)),
cause = null)
}
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala
index 89e0bf7fe41..865d6735cf6 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala
@@ -796,6 +796,17 @@ class QueryExecutionErrorsSuite
)
}
}
+
+ test("SPARK-43589: Use bytesToString instead of shift operation") {
+ checkError(
+ exception = intercept[SparkException] {
+ throw QueryExecutionErrors.cannotBroadcastTableOverMaxTableBytesError(
+ maxBroadcastTableBytes = 1024 * 1024 * 1024,
+ dataSize = 2 * 1024 * 1024 * 1024 - 1)
+ },
+ errorClass = "_LEGACY_ERROR_TEMP_2249",
+ parameters = Map("maxBroadcastTableBytes" -> "1024.0 MiB", "dataSize" -> "2048.0 MiB"))
+ }
}
class FakeFileSystemSetPermission extends LocalFileSystem {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org