-
Notifications
You must be signed in to change notification settings - Fork 29.2k
[SPARK-22452][SQL]Add getInt, getLong, getBoolean to DataSourceV2Options #19902
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
Changes from 2 commits
566b7a5
bb01ff5
15e8ce5
5de7962
7d87edc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,4 +49,22 @@ public DataSourceV2Options(Map<String, String> originalMap) { | |
| public Optional<String> get(String key) { | ||
| return Optional.ofNullable(keyLowerCasedMap.get(toLowerCase(key))); | ||
| } | ||
|
|
||
| public Optional<Boolean> getBoolean(String key) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to avoid the expensive boxing, how about
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good idea.
Please take a look. If we don't want (2), I can remove the version of the getBoolean, getLong, getInt that doesn't take the defaultValue. Thanks for your comments.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Per @gatorsmile , I have gone and removed the version of the methods that doesn't take the default value. |
||
| String lcaseKey = toLowerCase(key); | ||
| return Optional.ofNullable(keyLowerCasedMap.containsKey(lcaseKey) ? | ||
| Boolean.parseBoolean(keyLowerCasedMap.get(lcaseKey)) : null); | ||
| } | ||
|
|
||
| public Optional<Integer> getInt(String key) { | ||
| String lcaseKey = toLowerCase(key); | ||
| return Optional.ofNullable(keyLowerCasedMap.containsKey(lcaseKey) ? | ||
| Integer.parseInt(keyLowerCasedMap.get(lcaseKey)) : null); | ||
| } | ||
|
|
||
| public Optional<Long> getLong(String key) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you also remove the three APIs without the default values?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. Let me post another commit. Thanks. |
||
| String lcaseKey = toLowerCase(key); | ||
| return Optional.ofNullable(keyLowerCasedMap.containsKey(lcaseKey) ? | ||
| Long.parseLong(keyLowerCasedMap.get(lcaseKey)) : null); | ||
| } | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Thanks. Is it ok if I modify the comment for the method a bit to this: