-
Notifications
You must be signed in to change notification settings - Fork 3.9k
GH-47726 : [C++][FlightRPC] ODBC Unicode Support #47771
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
Conversation
* Let compiler append `W` to ODBC APIs where applicable. * pending fixes for changing namespaces
Co-authored-by: rscales <[email protected]> Length should be divided by number of characters in a wide string
|
|
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.
Would this make future porting to other platforms more difficult?
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.
Addressed David's comments
@lidavidm Are you referring to porting the unicode support to macOS/Linux platforms? Could you please elaborate on this point? |
Yes, would std::wstring cause issues on Linux/macOS? (I suppose the type is supported, but might be annoying since most OS APIs don't use wchar there...) |
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.
Now that I look at it there's a lot of ValueOr that I ignored earlier...I would expect the errors need to be propagated?
| const std::string& dflt = "") { | ||
| #define BUFFER_SIZE (1024) | ||
| std::vector<char> buf(BUFFER_SIZE); | ||
| std::wstring wdsn = arrow::util::UTF8ToWideString(dsn).ValueOr(L""); |
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.
Why are we ignoring errors here?
I suppose the return type doesn't allow for errors. But I'd expect that we update the return type to Result<std::string>.
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.
You raise a good point, these errors should not be ignored. I have added throws for the Result errors.
The caller will catch the exceptions thrown
|
|
||
| return std::string(buf.data(), ret); | ||
| std::wstring wresult = std::wstring(buf.data(), ret); | ||
| std::string result = arrow::util::WideStringToUTF8(wresult).ValueOr(""); |
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.
Same here.
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.
Same as above comment, I have added throws
Throw error if conversion fails Remove DSN window Leave enabling DSN window to apacheGH-46574
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.
Addressing David's comments
| const std::string& dflt = "") { | ||
| #define BUFFER_SIZE (1024) | ||
| std::vector<char> buf(BUFFER_SIZE); | ||
| std::wstring wdsn = arrow::util::UTF8ToWideString(dsn).ValueOr(L""); |
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.
You raise a good point, these errors should not be ignored. I have added throws for the Result errors.
The caller will catch the exceptions thrown
|
|
||
| return std::string(buf.data(), ret); | ||
| std::wstring wresult = std::wstring(buf.data(), ret); | ||
| std::string result = arrow::util::WideStringToUTF8(wresult).ValueOr(""); |
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.
Same as above comment, I have added throws
I will look into this and get back to you |
Continue adding places where exceptions need to be thrown or caught
b378900 to
08bf224
Compare
|
@lidavidm To follow up on the usage of |
|
After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit fc5fd48. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. |
Rationale for this change
Enable ODBC unicode support, so ODBC can handle wide characters.
What changes are included in this PR?
-DUNICODEto 1GetAttributeSQLWCHARAre these changes tested?
Build is tested locally
Are there any user-facing changes?
No