-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59756 from ClickHouse/backport/23.3/59739
Backport #59739 to 23.3: Fix leftPad / rightPad function with FixedString input
- Loading branch information
Showing
3 changed files
with
167 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
tests/queries/0_stateless/02986_leftpad_fixedstring.reference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
|
||
a String | ||
|
||
a String | ||
1 1 1 | ||
61 1 1 1 | ||
6162 1 1 1 | ||
616263 1 1 1 | ||
61626333 1 1 1 | ||
6162633334 1 1 1 | ||
616263333433 1 1 1 | ||
61626333343332 1 1 1 | ||
6162633334333234 1 1 1 | ||
206162633334333234 1 1 1 | ||
20206162633334333234 1 1 1 | ||
2020206162633334333234 1 1 1 | ||
202020206162633334333234 1 1 1 | ||
20202020206162633334333234 1 1 1 | ||
2020202020206162633334333234 1 1 1 | ||
202020202020206162633334333234 1 1 1 | ||
20202020202020206162633334333234 1 1 1 | ||
2020202020202020206162633334333234 1 1 1 | ||
202020202020202020206162633334333234 1 1 1 | ||
20202020202020202020206162633334333234 1 1 1 | ||
1 1 1 | ||
61 1 1 1 | ||
6162 1 1 1 | ||
616263 1 1 1 | ||
61626333 1 1 1 | ||
6162633334 1 1 1 | ||
616263333433 1 1 1 | ||
61626333343332 1 1 1 | ||
6162633334333234 1 1 1 | ||
616263333433323420 1 1 1 | ||
61626333343332342020 1 1 1 | ||
6162633334333234202020 1 1 1 | ||
616263333433323420202020 1 1 1 | ||
61626333343332342020202020 1 1 1 | ||
6162633334333234202020202020 1 1 1 | ||
616263333433323420202020202020 1 1 1 | ||
61626333343332342020202020202020 1 1 1 | ||
6162633334333234202020202020202020 1 1 1 | ||
616263333433323420202020202020202020 1 1 1 | ||
61626333343332342020202020202020202020 1 1 1 | ||
1 | ||
61 1 | ||
6162 1 | ||
616263 1 | ||
61626333 1 | ||
6162633334 1 | ||
616263333433 1 | ||
61626333343332 1 | ||
6162633334333234 1 | ||
F09F87AA6162633334333234 1 | ||
F09F87AAF09F87B86162633334333234 1 | ||
F09F87AAF09F87B8F09F87AA6162633334333234 1 | ||
F09F87AAF09F87B8F09F87AAF09F87B86162633334333234 1 | ||
F09F87AAF09F87B8F09F87AAF09F87B8F09F87AA6162633334333234 1 | ||
F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B86162633334333234 1 | ||
F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8F09F87AA6162633334333234 1 | ||
F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B86162633334333234 1 | ||
F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8F09F87AA6162633334333234 1 | ||
F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B86162633334333234 1 | ||
F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8F09F87AA6162633334333234 1 | ||
1 | ||
61 1 | ||
6162 1 | ||
616263 1 | ||
61626333 1 | ||
6162633334 1 | ||
616263333433 1 | ||
61626333343332 1 | ||
6162633334333234 1 | ||
6162633334333234F09F87AA 1 | ||
6162633334333234F09F87AAF09F87B8 1 | ||
6162633334333234F09F87AAF09F87B8F09F87AA 1 | ||
6162633334333234F09F87AAF09F87B8F09F87AAF09F87B8 1 | ||
6162633334333234F09F87AAF09F87B8F09F87AAF09F87B8F09F87AA 1 | ||
6162633334333234F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8 1 | ||
6162633334333234F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8F09F87AA 1 | ||
6162633334333234F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8 1 | ||
6162633334333234F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8F09F87AA 1 | ||
6162633334333234F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8 1 | ||
6162633334333234F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8F09F87AAF09F87B8F09F87AA 1 | ||
1 | ||
F09F87AA 1 | ||
F09F87AAF09F87B8 1 | ||
C391F09F87AAF09F87B8 1 | ||
C391C391F09F87AAF09F87B8 1 | ||
C391C391C391F09F87AAF09F87B8 1 | ||
C391C391C391C391F09F87AAF09F87B8 1 | ||
C391C391C391C391C391F09F87AAF09F87B8 1 | ||
C391C391C391C391C391C391F09F87AAF09F87B8 1 | ||
C391C391C391C391C391C391C391F09F87AAF09F87B8 1 | ||
C391C391C391C391C391C391C391C391F09F87AAF09F87B8 1 | ||
C391C391C391C391C391C391C391C391C391F09F87AAF09F87B8 1 | ||
C391C391C391C391C391C391C391C391C391C391F09F87AAF09F87B8 1 | ||
C391C391C391C391C391C391C391C391C391C391C391F09F87AAF09F87B8 1 | ||
C391C391C391C391C391C391C391C391C391C391C391C391F09F87AAF09F87B8 1 | ||
C391C391C391C391C391C391C391C391C391C391C391C391C391F09F87AAF09F87B8 1 | ||
C391C391C391C391C391C391C391C391C391C391C391C391C391C391F09F87AAF09F87B8 1 | ||
C391C391C391C391C391C391C391C391C391C391C391C391C391C391C391F09F87AAF09F87B8 1 | ||
C391C391C391C391C391C391C391C391C391C391C391C391C391C391C391C391F09F87AAF09F87B8 1 | ||
C391C391C391C391C391C391C391C391C391C391C391C391C391C391C391C391C391F09F87AAF09F87B8 1 | ||
1 | ||
F09F87AA 1 | ||
F09F87AAF09F87B8 1 | ||
F09F87AAF09F87B8C391 1 | ||
F09F87AAF09F87B8C391C391 1 | ||
F09F87AAF09F87B8C391C391C391 1 | ||
F09F87AAF09F87B8C391C391C391C391 1 | ||
F09F87AAF09F87B8C391C391C391C391C391 1 | ||
F09F87AAF09F87B8C391C391C391C391C391C391 1 | ||
F09F87AAF09F87B8C391C391C391C391C391C391C391 1 | ||
F09F87AAF09F87B8C391C391C391C391C391C391C391C391 1 | ||
F09F87AAF09F87B8C391C391C391C391C391C391C391C391C391 1 | ||
F09F87AAF09F87B8C391C391C391C391C391C391C391C391C391C391 1 | ||
F09F87AAF09F87B8C391C391C391C391C391C391C391C391C391C391C391 1 | ||
F09F87AAF09F87B8C391C391C391C391C391C391C391C391C391C391C391C391 1 | ||
F09F87AAF09F87B8C391C391C391C391C391C391C391C391C391C391C391C391C391 1 | ||
F09F87AAF09F87B8C391C391C391C391C391C391C391C391C391C391C391C391C391C391 1 | ||
F09F87AAF09F87B8C391C391C391C391C391C391C391C391C391C391C391C391C391C391C391 1 | ||
F09F87AAF09F87B8C391C391C391C391C391C391C391C391C391C391C391C391C391C391C391C391 1 | ||
F09F87AAF09F87B8C391C391C391C391C391C391C391C391C391C391C391C391C391C391C391C391C391 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
-- https://github.com/ClickHouse/ClickHouse/issues/59604 | ||
SELECT leftPad(toFixedString('abc', 3), 0), leftPad('abc', CAST('0', 'Int32')); | ||
SELECT leftPad(toFixedString('abc343243424324', 15), 1) as a, toTypeName(a); | ||
|
||
SELECT rightPad(toFixedString('abc', 3), 0), rightPad('abc', CAST('0', 'Int32')); | ||
SELECT rightPad(toFixedString('abc343243424324', 15), 1) as a, toTypeName(a); | ||
|
||
SELECT | ||
hex(leftPad(toFixedString('abc34324' as s, 8), number)) as result, | ||
hex(leftPad(s, number)) = result, | ||
hex(leftPadUTF8(toFixedString(s, 8), number)) = result, | ||
hex(leftPadUTF8(s, number)) = result | ||
FROM numbers(20); | ||
|
||
SELECT | ||
hex(rightPad(toFixedString('abc34324' as s, 8), number)) as result, | ||
hex(rightPad(s, number)) = result, | ||
hex(rightPadUTF8(toFixedString(s, 8), number)) = result, | ||
hex(rightPadUTF8(s, number)) = result | ||
FROM numbers(20); | ||
|
||
-- I'm not confident the behaviour should be like this. I'm only testing memory problems | ||
SELECT | ||
hex(leftPadUTF8(toFixedString('abc34324' as s, 8), number, '🇪🇸')) as result, | ||
hex(leftPadUTF8(s, number, '🇪🇸')) = result | ||
FROM numbers(20); | ||
|
||
SELECT | ||
hex(rightPadUTF8(toFixedString('abc34324' as s, 8), number, '🇪🇸')) as result, | ||
hex(rightPadUTF8(s, number, '🇪🇸')) = result | ||
FROM numbers(20); | ||
|
||
SELECT | ||
hex(leftPadUTF8(toFixedString('🇪🇸' as s, 8), number, 'Ñ')) as result, | ||
hex(leftPadUTF8(s, number, 'Ñ')) = result | ||
FROM numbers(20); | ||
|
||
SELECT | ||
hex(rightPadUTF8(toFixedString('🇪🇸' as s, 8), number, 'Ñ')) as result, | ||
hex(rightPadUTF8(s, number, 'Ñ')) = result | ||
FROM numbers(20); |