forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 0
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 ClickHouse#71580 from ClickHouse/bitshift-return-0…
…-instead-of-throwing-exception-for-out-of-bounds Return 0 or default char instead of throwing an error in bitShift functions in case of out of bounds
- Loading branch information
Showing
5 changed files
with
37 additions
and
23 deletions.
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
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
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
6 changes: 6 additions & 0 deletions
6
tests/queries/0_stateless/03198_bit_shift_throws_error_for_out_of_bounds.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 |
---|---|---|
@@ -1,3 +1,9 @@ | ||
-- bitShiftRight | ||
0 | ||
|
||
\0\0\0\0\0\0\0\0 | ||
-- bitShiftLeft | ||
0 | ||
|
||
\0\0\0\0\0\0\0\0 | ||
OK |
12 changes: 6 additions & 6 deletions
12
tests/queries/0_stateless/03198_bit_shift_throws_error_for_out_of_bounds.sql
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 |
---|---|---|
@@ -1,17 +1,17 @@ | ||
SELECT '-- bitShiftRight'; | ||
SELECT bitShiftRight(1, -1); -- { serverError ARGUMENT_OUT_OF_BOUND } | ||
SELECT bitShiftRight(toUInt8(1), 8 + 1); -- { serverError ARGUMENT_OUT_OF_BOUND } | ||
SELECT bitShiftRight(toUInt8(1), 8 + 1); | ||
SELECT bitShiftRight('hola', -1); -- { serverError ARGUMENT_OUT_OF_BOUND } | ||
SELECT bitShiftRight('hola', 4 * 8 + 1); -- { serverError ARGUMENT_OUT_OF_BOUND } | ||
SELECT bitShiftRight('hola', 4 * 8 + 1); | ||
SELECT bitShiftRight(toFixedString('hola', 8), -1); -- { serverError ARGUMENT_OUT_OF_BOUND } | ||
SELECT bitShiftRight(toFixedString('hola', 8), 8 * 8 + 1); -- { serverError ARGUMENT_OUT_OF_BOUND } | ||
SELECT bitShiftRight(toFixedString('hola', 8), 8 * 8 + 1); | ||
|
||
SELECT '-- bitShiftLeft'; | ||
SELECT bitShiftLeft(1, -1); -- { serverError ARGUMENT_OUT_OF_BOUND } | ||
SELECT bitShiftLeft(toUInt8(1), 8 + 1); -- { serverError ARGUMENT_OUT_OF_BOUND } | ||
SELECT bitShiftLeft(toUInt8(1), 8 + 1); | ||
SELECT bitShiftLeft('hola', -1); -- { serverError ARGUMENT_OUT_OF_BOUND } | ||
SELECT bitShiftLeft('hola', 4 * 8 + 1); -- { serverError ARGUMENT_OUT_OF_BOUND } | ||
SELECT bitShiftLeft('hola', 4 * 8 + 1); | ||
SELECT bitShiftLeft(toFixedString('hola', 8), -1); -- { serverError ARGUMENT_OUT_OF_BOUND } | ||
SELECT bitShiftLeft(toFixedString('hola', 8), 8 * 8 + 1); -- { serverError ARGUMENT_OUT_OF_BOUND } | ||
SELECT bitShiftLeft(toFixedString('hola', 8), 8 * 8 + 1); | ||
|
||
SELECT 'OK'; |