-
Notifications
You must be signed in to change notification settings - Fork 972
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
[IOTDB-417] Made all tests Locale Invariant by always explicitly defaulting to Locale.ENGLISH #726
Conversation
Kudos, SonarCloud Quality Gate passed!
|
I would like to have a look. |
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 for the PR @JulianFeinauer
The PR looks good to me for fix this issue, I only left one comment for simple the code change and one suggestion as follows:
I checked the entire project and found that String.format
is used in many places(not only in test code). We are fortunate to find this Local
problem in ITCase, but we cannot rule out that there are unpredictable problems hidden in other places, so I think would be better make a util similar with String.format
in IoTDB , and set the configuration we need in the util, such as Local
information, so that even if other problems are found in the future, we can fix it as a whole by modifying one place.
What do you think? @JulianFeinauer @jixuan1989
@@ -236,12 +236,12 @@ public void prepareMerge() throws SQLException { | |||
|
|||
// prepare BufferWrite data | |||
for (int i = 10001; i <= 20000; i++) { | |||
statement.execute(String.format(insertTemplate, i, i, i, (double) i, "\'" + i + "\'", | |||
statement.execute(String.format(Locale.ENGLISH, insertTemplate, i, i, i, (double) i, "\'" + i + "\'", |
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.
Just a suggestion: could you please set the default local in setUp()
, e.g., Locale.setDefault(Locale.ENGLISH);
, then we only need one line change.
What do you think?
I think many String.format() is used for log. Because all messages are in English, I wonder why a Locale is needed... |
Excellent idea... The issue is that with e. G German locals decimal points are printed as comma... |
@jixuan1989 if String.format is used for log only we have no issue but in the places above it is used to concatenate (or expand) Query Strings. And here, for some Locales (like e.g. German) the decimal points are expanded to decimal commas which leads to syntactically wrong statements, of course. So this, for sure, has to be Locale Invariant! |
I have checked. All String.format are used for either printing log or test. So, it should be ok. |
…cale.ENGLISH.
Fixes comment in my VOTE Email https://lists.apache.org/thread.html/rfef7f0035f28c3ee81ce32135e46e53774ce19b4af0bc06db426d4e3%40%3Cdev.iotdb.apache.org%3E