Skip to content

Commit

Permalink
[SPARK-49775][SQL][FOLLOW-UP] Use SortedSet instead of Array with sor…
Browse files Browse the repository at this point in the history
…ting

### 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]>
  • Loading branch information
HyukjinKwon authored and dongjoon-hyun committed Sep 25, 2024
1 parent 1f2e7b8 commit 09209f0
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
import java.nio.charset.{Charset, CharsetDecoder, CharsetEncoder, CodingErrorAction, IllegalCharsetNameException, UnsupportedCharsetException}
import java.util.Locale

import scala.collection.SortedSet

import org.apache.spark.sql.errors.QueryExecutionErrors
import org.apache.spark.sql.internal.SQLConf

private[sql] object CharsetProvider {

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

def forName(
charset: String,
Expand Down

0 comments on commit 09209f0

Please sign in to comment.