[Vectorized](function) support order by convert_to function (#14555)
This commit is contained in:
@ -0,0 +1,73 @@
|
||||
---
|
||||
{
|
||||
"title": "convert_to",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<version since="1.2">
|
||||
|
||||
## convert_to
|
||||
### description
|
||||
#### Syntax
|
||||
|
||||
` convert_to(VARCHAR column, VARCHAR character)`
|
||||
|
||||
It is used in the order by clause. eg: order by convert(column using gbk), Now only support character can be converted to 'gbk'.
|
||||
Because when the order by column contains Chinese, it is not arranged in the order of Pinyin
|
||||
After the character encoding of column is converted to gbk, it can be arranged according to pinyin
|
||||
|
||||
</version>
|
||||
|
||||
### example
|
||||
|
||||
```
|
||||
mysql> select * from class_test order by class_name;
|
||||
+----------+------------+-------------+
|
||||
| class_id | class_name | student_ids |
|
||||
+----------+------------+-------------+
|
||||
| 6 | asd | [6] |
|
||||
| 7 | qwe | [7] |
|
||||
| 8 | z | [8] |
|
||||
| 2 | 哈 | [2] |
|
||||
| 3 | 哦 | [3] |
|
||||
| 1 | 啊 | [1] |
|
||||
| 4 | 张 | [4] |
|
||||
| 5 | 我 | [5] |
|
||||
+----------+------------+-------------+
|
||||
|
||||
mysql> select * from class_test order by convert(class_name using gbk);
|
||||
+----------+------------+-------------+
|
||||
| class_id | class_name | student_ids |
|
||||
+----------+------------+-------------+
|
||||
| 6 | asd | [6] |
|
||||
| 7 | qwe | [7] |
|
||||
| 8 | z | [8] |
|
||||
| 1 | 啊 | [1] |
|
||||
| 2 | 哈 | [2] |
|
||||
| 3 | 哦 | [3] |
|
||||
| 5 | 我 | [5] |
|
||||
| 4 | 张 | [4] |
|
||||
+----------+------------+-------------+
|
||||
```
|
||||
### keywords
|
||||
convert_to
|
||||
@ -412,6 +412,7 @@
|
||||
"sql-manual/sql-functions/string-functions/split_part",
|
||||
"sql-manual/sql-functions/string-functions/money_format",
|
||||
"sql-manual/sql-functions/string-functions/parse_url",
|
||||
"sql-manual/sql-functions/string-functions/convert_to",
|
||||
"sql-manual/sql-functions/string-functions/extract_url_parameter",
|
||||
"sql-manual/sql-functions/string-functions/uuid",
|
||||
"sql-manual/sql-functions/string-functions/space",
|
||||
|
||||
@ -0,0 +1,73 @@
|
||||
---
|
||||
{
|
||||
"title": "convert_to",
|
||||
"language": "zh-CN"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<version since="1.2">
|
||||
|
||||
## convert_to
|
||||
### description
|
||||
#### Syntax
|
||||
|
||||
` convert_to(VARCHAR column, VARCHAR character)`
|
||||
在order by子句中使用,例如order by convert(column using gbk), 现在仅支持character转为'gbk'.
|
||||
因为当order by column中包含中文时,其排列不是按照汉语拼音的顺序.
|
||||
将column的字符编码转为gbk后,可实现按拼音的排列的效果.
|
||||
|
||||
</version>
|
||||
|
||||
### example
|
||||
|
||||
```
|
||||
mysql> select * from class_test order by class_name;
|
||||
+----------+------------+-------------+
|
||||
| class_id | class_name | student_ids |
|
||||
+----------+------------+-------------+
|
||||
| 6 | asd | [6] |
|
||||
| 7 | qwe | [7] |
|
||||
| 8 | z | [8] |
|
||||
| 2 | 哈 | [2] |
|
||||
| 3 | 哦 | [3] |
|
||||
| 1 | 啊 | [1] |
|
||||
| 4 | 张 | [4] |
|
||||
| 5 | 我 | [5] |
|
||||
+----------+------------+-------------+
|
||||
|
||||
mysql> select * from class_test order by convert(class_name using gbk);
|
||||
+----------+------------+-------------+
|
||||
| class_id | class_name | student_ids |
|
||||
+----------+------------+-------------+
|
||||
| 6 | asd | [6] |
|
||||
| 7 | qwe | [7] |
|
||||
| 8 | z | [8] |
|
||||
| 1 | 啊 | [1] |
|
||||
| 2 | 哈 | [2] |
|
||||
| 3 | 哦 | [3] |
|
||||
| 5 | 我 | [5] |
|
||||
| 4 | 张 | [4] |
|
||||
+----------+------------+-------------+
|
||||
|
||||
```
|
||||
### keywords
|
||||
convert_to
|
||||
Reference in New Issue
Block a user