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

string-functions: add instrunctions for LEFT() and LENGTH() #16068

Conversation

takaidohigasi
Copy link
Contributor

@takaidohigasi takaidohigasi commented Jan 10, 2024

First-time contributors' checklist

What is changed, added or deleted? (Required)

Fix #15491

This PR adds instructions for the LEFT() and LENGTH function. (one of the doc dash issues)

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 the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 10, 2024
@CLAassistant
Copy link

CLAassistant commented Jan 10, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

ti-chi-bot bot commented Jan 10, 2024

Welcome @takaidohigasi!

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 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. missing-translation-status This PR does not have translation status info. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 10, 2024
@takaidohigasi
Copy link
Contributor Author

takaidohigasi commented Jan 10, 2024

@takaidohigasi takaidohigasi force-pushed the 15491-enrich-instructions-for-left-and-length-func branch from 750fc3e to dc177e2 Compare January 10, 2024 06:08
@takaidohigasi takaidohigasi marked this pull request as ready for review January 10, 2024 06:13
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 10, 2024
Copy link
Contributor

@dveeden dveeden left a comment

Choose a reason for hiding this comment

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

The content looks very good. I think it explains the normal case as well as common corner cases.

I think the SQL statement and output should be in separate blocks like this:

```sql
SELECT 1
```
```
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.01 sec)
```

Maybe the text for LENGTH() should have a reference to CHAR_LENGTH()?

mysql> SELECT LENGTH('Café');
+-----------------+
| LENGTH('Café')  |
+-----------------+
|               5 |
+-----------------+
1 row in set (0.00 sec)

mysql> SELECT CHAR_LENGTH('Café');
+----------------------+
| CHAR_LENGTH('Café')  |
+----------------------+
|                    4 |
+----------------------+
1 row in set (0.00 sec)

There might be some more wording and formatting things that need to be done.

@dveeden dveeden requested review from ran-huang and qiancai January 10, 2024 07:03
@takaidohigasi
Copy link
Contributor Author

takaidohigasi commented Jan 10, 2024

The content looks very good. I think it explains the normal case as well as common corner cases.

I think the SQL statement and output should be in separate blocks like this:

```sql
SELECT 1
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.01 sec)

I will follow the documentation rule.
I followed existing example on the file and there are some similar documents, and I'm wondering what to do.

```sql
SELECT ASCII('A');
+------------+
| ASCII('A') |
+------------+
| 65 |
+------------+
```

https://github.com/pingcap/docs/blob/611cddeb452ec2a652b1a644e36079fa6e1253a4/functions-and-operators/precision-math.md#rounding-behavior

Maybe the text for LENGTH() should have a reference to CHAR_LENGTH()?

mysql> SELECT LENGTH('Café');
+-----------------+
| LENGTH('Café')  |
+-----------------+
|               5 |
+-----------------+
1 row in set (0.00 sec)

mysql> SELECT CHAR_LENGTH('Café');
+----------------------+
| CHAR_LENGTH('Café')  |
+----------------------+
|                    4 |
+----------------------+
1 row in set (0.00 sec)

thanks, OK, I will add for this

functions-and-operators/string-functions.md Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jan 10, 2024
Co-authored-by: Daniël van Eeden <[email protected]>
@qiancai qiancai added 2024-tidb-docs-dash This issue or PR is included in the 2024 TiDB Docs Dash event. translation/doing This PR's assignee is translating this PR. and removed missing-translation-status This PR does not have translation status info. labels Jan 10, 2024
@qiancai qiancai requested a review from SeaRise January 11, 2024 08:20
Copy link
Contributor

@SeaRise SeaRise left a comment

Choose a reason for hiding this comment

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

lgtm

@qiancai qiancai removed the request for review from ran-huang January 23, 2024 15:38
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
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 29, 2024
Copy link

ti-chi-bot bot commented Jan 29, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-01-10 07:35:48.71467176 +0000 UTC m=+428738.298925432: ☑️ agreed by dveeden.
  • 2024-01-29 07:33:49.576557659 +0000 UTC m=+1378071.140855364: ☑️ agreed by hfxsd.

@qiancai
Copy link
Collaborator

qiancai commented Jan 30, 2024

/approve

Copy link

ti-chi-bot bot commented Jan 30, 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 Jan 30, 2024
@qiancai
Copy link
Collaborator

qiancai commented Jan 30, 2024

/test pull-verify

@ti-chi-bot ti-chi-bot bot merged commit 3874026 into pingcap:master Jan 30, 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 5, 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 LEFT() and LENGTH()
6 participants