-
Notifications
You must be signed in to change notification settings - Fork 28.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-26594][SQL] DataSourceOptions.asMap should return CaseInsensitiveMap #24062
Conversation
ping @zsxwing. |
Test build #103353 has finished for PR 24062 at commit
|
@@ -92,8 +94,8 @@ public DataSourceOptions(Map<String, String> originalMap) { | |||
} | |||
} | |||
|
|||
public Map<String, String> asMap() { | |||
return new HashMap<>(keyLowerCasedMap); | |||
public CaseInsensitiveMap<String> asMap() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there was a discussion that returning CaseInsensitiveMap
was a bad design before (IIRC). I think that's the reason why it return a regular map instead. Why don't we just clearly document what it returns? I think this can be a conservative compromise as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any link for the discussion? I didn't find in #19925.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I talked with @cloud-fan and @rxin. I might remember this wrongly. CaseInsensitiveMap
is an internal class from catalyst
. We shouldn't expose it like this anyway.
Can we wait for #24025 ? |
Ya. Let's proceed #24025 first. |
Yeah, let's wait for #24025 finish first. |
Test build #103358 has finished for PR 24062 at commit
|
@@ -104,4 +104,9 @@ class DataSourceOptionsSuite extends SparkFunSuite { | |||
|
|||
assert(options.paths().toSeq == Seq("c", "d\"e")) | |||
} | |||
|
|||
test("asMap") { | |||
val map = new DataSourceOptions(Map("fooBar" -> "x").asJava).asMap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned above, close this PR and maybe the jira can also be closed after #24025. |
This File DataSourceOptions, what is it renamed as in Spark-3 scala 2.12 code? As the complete directory structure is changed. |
Hi, @chiragsanghvi18 . It sounds like a git command question instead of Apache Spark question.
Please try the following. SPARK-27106 removed it instead of renaming.
|
Thanks a ton, you're a savior. |
What changes were proposed in this pull request?
The DataSourceOptions use an immutable string-to-string map internally in which keys are case-insensitive, so while we call
asMap
, it should also return a case-insensitive map.Here make
DataSourceOptions.asMap
return CaseInsensitiveMap.How was this patch tested?
New case in DataSourceOptionsSuite.