-
Notifications
You must be signed in to change notification settings - Fork 6k
expression: Support more locales for func FORMAT() | tidb-test=pr/2626 #64316
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
base: master
Are you sure you want to change the base?
Conversation
…_BD,bn_IN,dz_BT...
|
Hi @ghoshh. Thanks for your PR. I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Hi @ghoshh. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/ok-to-test |
|
/cc @dveeden |
tangenta
left a comment
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.
Rest LGTM
dveeden
left a comment
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.
Looks like warnings for incorrect locales are missing.
MySQL:
mysql-9.5.0> \W
Show warnings enabled.
mysql-9.5.0> SELECT FORMAT(1234.56,2,'en_US');
+---------------------------+
| FORMAT(1234.56,2,'en_US') |
+---------------------------+
| 1,234.56 |
+---------------------------+
1 row in set (0.000 sec)
mysql-9.5.0> SELECT FORMAT(1234.56,2,'en_NL');
+---------------------------+
| FORMAT(1234.56,2,'en_NL') |
+---------------------------+
| 1,234.56 |
+---------------------------+
1 row in set, 1 warning (0.000 sec)
Warning (Code 1649): Unknown locale: 'en_NL'
TiDB (this PR):
tidb-8.0.11-TiDB-v9.0.0-beta.2.pre-730-g451b09b426> \W
Show warnings enabled.
tidb-8.0.11-TiDB-v9.0.0-beta.2.pre-730-g451b09b426> SELECT FORMAT(1234.56,2,'en_US');
+---------------------------+
| FORMAT(1234.56,2,'en_US') |
+---------------------------+
| 1,234.56 |
+---------------------------+
1 row in set (0.001 sec)
tidb-8.0.11-TiDB-v9.0.0-beta.2.pre-730-g451b09b426> SELECT FORMAT(1234.56,2,'en_NL');
+---------------------------+
| FORMAT(1234.56,2,'en_NL') |
+---------------------------+
| 1,234.56 |
+---------------------------+
1 row in set (0.000 sec)
tidb-8.0.11-TiDB-v9.0.0-beta.2.pre-730-g451b09b426>
|
In #56168 I tried to use golang.org/x/text/{language,message,number} so we can automatically benefit from improvements in the library done by others... but that seems to introduce more issues than it solves. But that PR might have some useful comments. |
|
A difference between MySQL and TiDB: |
|
I would suggest to create a list of locales and then connect to TiDB and MySQL and for each of them compare the output. |
|
For MySQL does this: This looks like an issue with the test as the new result matches the MySQL output. |
|
I did this: cd tests/integrationtest
./run-tests.sh -r expression/builtin
git diffThe result is this: diff --git a/tests/integrationtest/r/expression/builtin.result b/tests/integrationtest/r/expression/builtin.result
index 38500f943c..59c612eda1 100644
--- a/tests/integrationtest/r/expression/builtin.result
+++ b/tests/integrationtest/r/expression/builtin.result
@@ -2103,9 +2103,7 @@ format(NULL, 4) format(12332.2, NULL)
NULL NULL
select format(12332.2, 2,'es_EC');
format(12332.2, 2,'es_EC')
-12,332.20
-Level Code Message
-Warning 1649 Unknown locale: 'es_EC'
+12.332,20
select field(1, 2, 1), field(1, 0, NULL), field(1, NULL, 2, 1), field(NULL, 1, 2, NULL);
field(1, 2, 1) field(1, 0, NULL) field(1, NULL, 2, 1) field(NULL, 1, 2, NULL)
2 0 3 0This should fix the |
|
The |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #64316 +/- ##
================================================
+ Coverage 72.7432% 73.3558% +0.6125%
================================================
Files 1861 1863 +2
Lines 504392 508411 +4019
================================================
+ Hits 366911 372949 +6038
+ Misses 115176 113176 -2000
+ Partials 22305 22286 -19
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
… locale(not modified builtin_string_vec.go yet)
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
// Test an invalid/unmapped locale
// Should fallback to en_US (styleCommaDot) with NO error and NO warning.
{12345.67, 2, "de_GE", "12,345.67", false, "Invalid locale 'de_GE' fallback"},
{12345.67, 2, "non_existent", "12,345.67", false, "Invalid locale 'non_existent' fallback"},For the |
Oh,yes,I forgot to change this test case. |
|
I found another issue unfortunately: MySQL: TiDB (this PR): WITH l AS (
SELECT 'en_US' ln
UNION ALL
SELECT 'ru_RU'
UNION ALL
SELECT 'fr_BE'
UNION ALL
SELECT 'it_CH'
)
SELECT ln,FORMAT(1234.67,3,ln) FROM l |
|
@ghoshh: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
What problem does this PR solve?
Issue Number: ref #56167
Problem Summary:
What changed and how does it work?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.