Skip to content
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

Enrich instructions for string functions INSTR() and LCASE() #16144

Merged
merged 14 commits into from
Feb 6, 2024

Conversation

jyf111
Copy link
Contributor

@jyf111 jyf111 commented Jan 13, 2024

First-time contributors' checklist

What is changed, added or deleted? (Required)

Fix #15489.

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions.

  • master (the latest development version)
  • v7.6 (TiDB 7.6 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.4 (TiDB 7.4 versions)
  • v7.3 (TiDB 7.3 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)
  • v5.3 (TiDB 5.3 versions)
  • v5.2 (TiDB 5.2 versions)
  • v5.1 (TiDB 5.1 versions)
  • v5.0 (TiDB 5.0 versions)

What is the related PR or file link(s)?

  • This PR is translated from:
  • Other reference link(s):

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

@ti-chi-bot ti-chi-bot bot added contribution This PR is from a community contributor. first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. labels Jan 13, 2024
Copy link

ti-chi-bot bot commented Jan 13, 2024

Welcome @jyf111!

It looks like this is your first PR to pingcap/docs 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/docs. 😃

@ti-chi-bot ti-chi-bot bot added missing-translation-status This PR does not have translation status info. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 13, 2024
jyf111 and others added 4 commits January 16, 2024 21:37
add a case insensitive example for INSTR()
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 16, 2024
@jyf111 jyf111 requested a review from dveeden January 16, 2024 14:12
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jan 16, 2024
@dveeden
Copy link
Contributor

dveeden commented Jan 17, 2024

@jyf111 there are a few issues reported by the verify ci job:

[2024-01-16T14:15:17.567Z] functions-and-operators/string-functions.md: this file has manual line breaks in the following lines:
[2024-01-16T14:15:17.567Z] 
[2024-01-16T14:15:17.567Z] MANUAL LINE BREAKS: L167
[2024-01-16T14:15:17.567Z] MANUAL LINE BREAKS: L168
[2024-01-16T14:15:17.567Z] MANUAL LINE BREAKS: L169
[2024-01-16T14:15:17.567Z] MANUAL LINE BREAKS: L177
[2024-01-16T14:15:17.567Z] MANUAL LINE BREAKS: L178
[2024-01-16T14:15:17.567Z] MANUAL LINE BREAKS: L235
[2024-01-16T14:15:17.567Z] MANUAL LINE BREAKS: L256
[2024-01-16T14:15:17.567Z] 
[2024-01-16T14:15:17.567Z] The above issues will cause website build failure. Please fix them.

@dveeden dveeden requested review from ran-huang and qiancai January 17, 2024 08:36
fix manual line breaks
fix manual line breaks
@qiancai qiancai added the 2024-tidb-docs-dash This issue or PR is included in the 2024 TiDB Docs Dash event. label Jan 31, 2024
@qiancai qiancai self-assigned this Jan 31, 2024
@qiancai qiancai added the translation/doing This PR's assignee is translating this PR. label Feb 1, 2024
@ti-chi-bot ti-chi-bot bot removed the missing-translation-status This PR does not have translation status info. label Feb 1, 2024
functions-and-operators/string-functions.md Outdated Show resolved Hide resolved
functions-and-operators/string-functions.md Outdated Show resolved Hide resolved
functions-and-operators/string-functions.md Outdated Show resolved Hide resolved
functions-and-operators/string-functions.md Outdated Show resolved Hide resolved
@Oreoxmt Oreoxmt self-requested a review February 1, 2024 06:31
@qiancai qiancai removed the request for review from ran-huang February 1, 2024 06:59
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 1, 2024
Copy link

ti-chi-bot bot commented Feb 1, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-01-16 14:29:37.513592644 +0000 UTC m=+279819.077890347: ☑️ agreed by dveeden.
  • 2024-02-01 07:22:31.189770372 +0000 UTC m=+1636592.754068077: ☑️ agreed by Oreoxmt.

@Oreoxmt
Copy link
Collaborator

Oreoxmt commented Feb 1, 2024

/test pull-verify

Copy link
Contributor

@xzhangxian1008 xzhangxian1008 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other LGTM

```

```sql
SELECT INSTR("pingcap.com/tidb", "TiDB");
Copy link
Contributor

@xzhangxian1008 xzhangxian1008 Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which tidb version do you use? I tried it on my tidb cluster with tidb commit cac449b3370c5, and get different result.

mysql> SELECT INSTR("pingcap.com/tidb", "TiDB");
+-----------------------------------+
| INSTR("pingcap.com/tidb", "TiDB") |
+-----------------------------------+
|                                13 |
+-----------------------------------+

and we can get 0 with this sql

mysql> SELECT INSTR(_utf8mb4 "pingcap.com/tidb", _utf8mb4 "TiDB");
+-----------------------------------------------------+
| INSTR(_utf8mb4 "pingcap.com/tidb", _utf8mb4 "TiDB") |
+-----------------------------------------------------+
|                                                   0 |
+-----------------------------------------------------+

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mysql> SELECT TIDB_VERSION()\G
*************************** 1. row ***************************
TIDB_VERSION(): Release Version: v7.1.1-serverless
Edition: Community
Git Commit Hash: 14db49a2968b68ac4cf3e4a59db87ba30a97996d
Git Branch: release-7.1-serverless
UTC Build Time: 2024-01-29 10:05:53
GoVersion: go1.21.6
Race Enabled: false
TiKV Min Version: 6.1.0
Check Table Before Drop: false
Store: tikv
1 row in set (0.24 sec)

mysql> SHOW VARIABLES LIKE 'collation\_%';
+----------------------+-------------+
| Variable_name        | Value       |
+----------------------+-------------+
| collation_connection | utf8mb4_bin |
| collation_database   | utf8mb4_bin |
| collation_server     | utf8mb4_bin |
+----------------------+-------------+
3 rows in set (0.25 sec)

mysql> SELECT INSTR("pingcap.com/tidb", "TiDB");
+-----------------------------------+
| INSTR("pingcap.com/tidb", "TiDB") |
+-----------------------------------+
|                                 0 |
+-----------------------------------+
1 row in set (0.24 sec)

Copy link
Collaborator

@qiancai qiancai Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jyf111, thanks for sharing the version info. Currently, the "master" branch of TiDB docs is for TiDB v7.6.0. Would you please try installing TiDB v7.6 according to this quick start guide? Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mysql> SELECT TIDB_VERSION()\G
*************************** 1. row ***************************
TIDB_VERSION(): Release Version: v7.6.0
Edition: Community
Git Commit Hash: 52794d985ba6325d75a714d4eaa0838d59425eb6
Git Branch: heads/refs/tags/v7.6.0
UTC Build Time: 2024-01-22 14:20:42
GoVersion: go1.21.5
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.01 sec)

mysql> SHOW VARIABLES LIKE 'collation\_%';
+----------------------+--------------------+
| Variable_name        | Value              |
+----------------------+--------------------+
| collation_connection | utf8mb4_0900_ai_ci |
| collation_database   | utf8mb4_bin        |
| collation_server     | utf8mb4_bin        |
+----------------------+--------------------+
3 rows in set (0.01 sec)

mysql> SELECT INSTR("pingcap.com/tidb", "TiDB");
+-----------------------------------+
| INSTR("pingcap.com/tidb", "TiDB") |
+-----------------------------------+
|                                13 |
+-----------------------------------+
1 row in set (0.00 sec)

Um.. But I don't know why collation_connection becomes utf8mb4_0900_ai_ci.

The latest doc still shows that the default value of collation_connection is utf8mb4_bin.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jyf111, thanks for checking the version.

According to @YangKeao (a TiDB developer), utf8mb4_0900_ai_ci was introduced in v7.4 to be compatible with MySQL 8.0 (pingcap/tidb#45650).

Starting from v7.4.0, the default collation of utf8mb4 on TiDB depends on the version of MySQL client, and @YangKeao will create a PR to clarify this issue in the doc.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. I have updated the sentences related to case sensitivity and collations. PTAL

Copy link

ti-chi-bot bot commented Feb 1, 2024

@xzhangxian1008: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

Other LGTM

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/test-infra repository.

@qiancai
Copy link
Collaborator

qiancai commented Feb 6, 2024

/retest

@qiancai
Copy link
Collaborator

qiancai commented Feb 6, 2024

/retest

@qiancai
Copy link
Collaborator

qiancai commented Feb 6, 2024

/retest

@qiancai
Copy link
Collaborator

qiancai commented Feb 6, 2024

/approve

Copy link

ti-chi-bot bot commented Feb 6, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qiancai

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the approved label Feb 6, 2024
@ti-chi-bot ti-chi-bot bot merged commit e49428c into pingcap:master Feb 6, 2024
8 of 9 checks passed
@qiancai qiancai added translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. and removed translation/doing This PR's assignee is translating this PR. labels Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2024-tidb-docs-dash This issue or PR is included in the 2024 TiDB Docs Dash event. approved contribution This PR is from a community contributor. first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. lgtm size/L Denotes a PR that changes 100-499 lines, ignoring generated files. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR.
Development

Successfully merging this pull request may close these issues.

Enrich instructions for string functions INSTR() and LCASE()
5 participants