This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push: new ae4c17988b [doc](function)support bit_test function (#1214) ae4c17988b is described below commit ae4c17988b20f295280e079006965c3cf78ab847 Author: zhangstar333 <87313068+zhangstar...@users.noreply.github.com> AuthorDate: Wed Oct 23 22:29:30 2024 +0800 [doc](function)support bit_test function (#1214) # Versions - [x] dev - [ ] 3.0 - [ ] 2.1 - [ ] 2.0 # Languages - [x] Chinese - [x] English --- .../sql-functions/bitwise-functions/bit_test.md | 65 ++++++++++++++++++++++ .../sql-functions/bitwise-functions/bit_test.md | 64 +++++++++++++++++++++ sidebars.json | 1 + 3 files changed, 130 insertions(+) diff --git a/docs/sql-manual/sql-functions/bitwise-functions/bit_test.md b/docs/sql-manual/sql-functions/bitwise-functions/bit_test.md new file mode 100644 index 0000000000..dcb6a80c8a --- /dev/null +++ b/docs/sql-manual/sql-functions/bitwise-functions/bit_test.md @@ -0,0 +1,65 @@ +--- +{ +"title": "BIT_TEST", +"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. +--> + +## bit_test +### description +#### Syntax + +`bit_test(Integer-type value, Integer-type pos, '......')` + +"Convert the value of 'value' into binary form and return the value at the specified position 'pos', where 'pos' starts from 0 and goes from right to left. If there are multiple values for 'pos', combine the values at multiple 'pos' positions using the AND operator and return the final result. +If the value of pos is negative or exceeds the total number of bits in value, the result will be 0. +Integer value ranges: TINYINT, SMALLINT, INT, BIGINT, LARGEINT." + +### example + +### example + +mysql [(none)]>SELECT bit_test(43, 1); ++-----------------+ +| bit_test(43, 1) | ++-----------------+ +| 1 | ++-----------------+ + +mysql [(none)]>select bit_test(43,-1); ++------------------+ +| bit_test(43, -1) | ++------------------+ +| 0 | ++------------------+ + +mysql [(none)]>SELECT bit_test(43, 0, 1, 3, 5,2); ++-----------------------------+ +| bit_test(43, 0, 1, 3, 5, 2) | ++-----------------------------+ +| 0 | ++-----------------------------+ +``` + +### keywords + + bit_test,bit_test_all diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/bitwise-functions/bit_test.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/bitwise-functions/bit_test.md new file mode 100644 index 0000000000..4a140eb167 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/bitwise-functions/bit_test.md @@ -0,0 +1,64 @@ +--- +{ +"title": "BIT_TEST", +"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. +--> + +## bit_test +### description +#### Syntax + +`bit_test(Integer-type value, Integer-type pos, '......')` + +将value的值转换为二进制的形式,返回指定位置pos的值,pos从0开始,从右到左。 +如果pos 有多个值,则将多个pos位置上的值用与运算符结合起来,返回最终结果。 +如果pos 的取值为负数或者超过value的bit位总数,则会返回结果为0. +整数value范围:TINYINT、SMALLINT、INT、BIGINT、LARGEINT + +### example + +mysql [(none)]>SELECT bit_test(43, 1); ++-----------------+ +| bit_test(43, 1) | ++-----------------+ +| 1 | ++-----------------+ + +mysql [(none)]>select bit_test(43,-1); ++------------------+ +| bit_test(43, -1) | ++------------------+ +| 0 | ++------------------+ + +mysql [(none)]>SELECT bit_test(43, 0, 1, 3, 5,2); ++-----------------------------+ +| bit_test(43, 0, 1, 3, 5, 2) | ++-----------------------------+ +| 0 | ++-----------------------------+ +``` + +### keywords + + bit_test,bit_test_all diff --git a/sidebars.json b/sidebars.json index e7ed55e830..b42007302b 100644 --- a/sidebars.json +++ b/sidebars.json @@ -1120,6 +1120,7 @@ "label": "Bitwise Functions", "items": [ "sql-manual/sql-functions/bitwise-functions/bitand", + "sql-manual/sql-functions/bitwise-functions/bit_test", "sql-manual/sql-functions/bitwise-functions/bitor", "sql-manual/sql-functions/bitwise-functions/bitxor", "sql-manual/sql-functions/bitwise-functions/bitnot", --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org