RPAD似乎有问题,因为以下查询的响应为真:
SELECT LPAD(" hello world",7)= RPAD(" hello world",7);
JobId:custom-manifest-113615:bquijob_6cbc14f2_15ce386dbf3
答案 0 :(得分:2)
我觉得这不是错误,并按预期返回结果
LPAD / RPAD(“hello world”,7) - 返回“hello world”的7个字符,因为那里有超过7个字符 - 它们只返回那些没有任何填充的字符。 “你好w”和“你好w”
要查看LPAD / RPAD的运行情况,请执行以下操作
#standardSQL
SELECT
LPAD("hello world", 17) as lpad,
RPAD("hello world", 17) as rpad,
LPAD("hello world", 17) = RPAD("hello world", 17) as compare
和
#standardSQL
SELECT
LPAD("hello world", 17, ".") as lpad,
RPAD("hello world", 17, ".") as rpad,
LPAD("hello world", 17, ".") = RPAD("hello world", 17, ".") as compare
从文档中For example, RPAD("hello world", 7); returns "o world".
开始 - 我觉得这是不正确的!
Rightness
或Leftness
仅用于了解模式填充的方向!
注意:填充模式的默认值为blank space