上云无忧 > 文档中心 > 百度数据仓库 Palo SQL语法手册 - 位操作函数
百度数据仓库 Palo Doris版
百度数据仓库 Palo SQL语法手册 - 位操作函数

文档简介:
PALO 支持以下位操作函数: 1.bitand 2.bitnot 3.bitor 4.bitxor BITAND Desciption: bitand(integer_type a, same_type b) 功能:按位与运算 返回类型: 和输入类型相同
*此产品及展示信息均由百度智能云官方提供。免费试用 咨询热线:400-826-7010,为您提供专业的售前咨询,让您快速了解云产品,助您轻松上云! 微信咨询
  免费试用、价格特惠

PALO 支持以下位操作函数:

1.bitand
2.bitnot
3.bitor
4.bitxor

BITAND

Desciption

bitand(integer_type a, same_type b)
  • 功能:按位与运算
  • 返回类型: 和输入类型相同

Example

mysql> select bitand(255, 32767); /* 0000000011111111 & 0111111111111111 */ +----
----------------+ | bitand(255, 32767) | +--------------------+ | 255 | +-----------
---------+ mysql> select bitand(32767, 1); /* 0111111111111111 & 0000000000000001 */ +---
---------------+ | bitand(32767, 1) | +------------------+ | 1 | +------------------+ mysql> 
select bitand(32, 16); /* 00010000 & 00001000 */ +----------------+ | bitand(32, 16) | +------
----------+ | 0 | +----------------+ mysql> select bitand(12,5); /* 00001100 & 00000101 */ +----
-----------+ | bitand(12, 5) | +---------------+ | 4 | +---------------+ mysql> select bitand(-1,15);
 /* 11111111 & 00001111 */ +----------------+ | bitand(-1, 15) | +----------------+ | 15 | +----------------+

Keywords

bitand

BITNOT

Desciption

bitnot(integer_type a)
  • 功能:按位非运算
  • 返回类型:和输入类型相同

Example

mysql> select bitnot(127); /* 01111111 -> 10000000 */ +-------------+ | bitnot(127) | +-------------+ | 
-128 | +-------------+ mysql> select bitnot(16); /* 00010000 -> 11101111 */ +------------+ | bitnot(16) 
| +------------+ | -17 | +------------+ mysql> select bitnot(0); /* 00000000 -> 11111111 */ +---------
--+ | bitnot(0) | +-----------+ | -1 | +-----------+ mysql> select bitnot(-128); /* 10000000 -> 01111111 
*/ +--------------+ | bitnot(-128) | +--------------+ | 127 | +--------------+

Keywords

bitnot

BITOR

Desciption

bitor(integer_type a, same_type b)
  • 功能:按位或运算
  • 返回类型:和输入类型相同

Example

mysql> select bitor(1,4); /* 00000001 | 00000100 */ +-------------+ | bitor(1, 4) | +-------------+ 
| 5 | +-------------+ mysql> select bitor(16,48); /* 00001000 | 00011000 */ +---------------+ 
| bitor(16, 48) | +---------------+ | 48 | +---------------+ mysql> select bitor(0,7); /* 00000000
 | 00000111 */ +-------------+ | bitor(0, 7) | +-------------+ | 7 | +-------------+

Keywords

bitor

BITXOR

Desciption

bitxor(integer_type a, same_type b)
  • 功能:按位异或运算
  • 返回类型:和输入类型相同

Example

mysql> select bitxor(0,15); /* 00000000 ^ 00001111 */ +---------------+ | bitxor(0, 15) | +----
-----------+ | 15 | +---------------+ mysql> select bitxor(7,7); /* 00000111 ^ 00000111 */ +-----
---------+ | bitxor(7, 7) | +--------------+ | 0 | +--------------+ mysql> select bitxor(8,4); 
/* 00001000 ^ 00000100 */ +--------------+ | bitxor(8, 4) | +--------------+ | 12 | +---------
-----+ mysql> select bitxor(3,7); /* 00000011 ^ 00000111 */ +--------------+ | bitxor(3, 7) 
| +--------------+ | 4 | +--------------+

Keywords

bitxor

相似文档
  • PALO支持的哈希函数如下: 1.murmur_hash3_32 MURMUR_HASH3_32 Description: INT MURMUR_HASH3_32(VARCHAR input, ...) 功能:返回输入字符串的32位murmur3 hash值 返回类型:string类型
  • PALO支持的字符串函数如下: 1.append_trailing_char_if_absent 2.ascii 3.concat 4.concat_ws 5.ends_with 6.find_in_set 7.group_concat 8.instr 9.length,char_length,character_length 10.locate 11.lower,lcase 12.lpad 13.ltrim 14.money_format 15.null_or_empty 16.parse_url 17.regexp_extract 18.regexp_replace 19.repeat 20.replace 21.reverse 22.rpad 23.rtrim 24.space 25.split_part 26.starts_with 27.strleft,left 28.strright,right 29.substr,substring 30.trim 31.upper,ucase
  • PALO 支持以下数学函数: 1.sin 2.asin 3.tan 4.atan 5.cos 6.acos 7.abs 8.bin 9.ceil 10.floor 11.conv 12.degrees 13.e 14.exp 15.mod 16.fmod 17.pmod 18.greatest 19.least 20.hex 21.unhex 22.ln 23.dlog1 24.log 25.negative 26.positive 27.pi 28.pow 29.radians 30.rand 31.round 32.sign 33.sqrt 34.truncate
  • PALO 支持的条件函数如下: 1.case 2.coalesce 3.if 4.ifnull 5.nullif
  • PALO 支持的时间类型 包括 DATE 和 DATETIME 两种类型。 DATE 类型格式为:"2020-10-10" DATETIME 类型格式为:"2020-10-10 11:10:06" PALO 支持的日期和时间函数如下:
官方微信
联系客服
400-826-7010
7x24小时客服热线
分享
  • QQ好友
  • QQ空间
  • 微信
  • 微博
返回顶部