Skip to content

Commit 09209f0

Browse files
HyukjinKwondongjoon-hyun
authored andcommitted
[SPARK-49775][SQL][FOLLOW-UP] Use SortedSet instead of Array with sorting
### What changes were proposed in this pull request? This PR is a followup of #48235 that addresses #48235 (comment) comment. ### Why are the changes needed? For better performance (in theory) ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Existing tests should verify them ### Was this patch authored or co-authored using generative AI tooling? No. Closes #48245 from HyukjinKwon/SPARK-49775-followup. Authored-by: Hyukjin Kwon <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 1f2e7b8 commit 09209f0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/CharsetProvider.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@
1818
import java.nio.charset.{Charset, CharsetDecoder, CharsetEncoder, CodingErrorAction, IllegalCharsetNameException, UnsupportedCharsetException}
1919
import java.util.Locale
2020

21+
import scala.collection.SortedSet
22+
2123
import org.apache.spark.sql.errors.QueryExecutionErrors
2224
import org.apache.spark.sql.internal.SQLConf
2325

2426
private[sql] object CharsetProvider {
2527

2628
final lazy val VALID_CHARSETS =
27-
Array("us-ascii", "iso-8859-1", "utf-8", "utf-16be", "utf-16le", "utf-16", "utf-32").sorted
29+
SortedSet("us-ascii", "iso-8859-1", "utf-8", "utf-16be", "utf-16le", "utf-16", "utf-32")
2830

2931
def forName(
3032
charset: String,

0 commit comments

Comments
 (0)