-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If statement not working correctly with decrypt function #38040
Comments
Hi, just a quick update. Reviewing the documentation, I've seen that this config |
Hi @alexey-milovidov @Avogar , any thoughts on this issue? |
Seems like a bug in short circuit function evaluation. Simple case that doesn't work: :) select number >= 0 and if(number != 0, intDiv(1, number), 1) from numbers(5)
SELECT (number >= 0) AND if(number != 0, intDiv(1, number), 1)
FROM numbers(5)
Query id: 04e9df11-8387-4b87-b100-13b27a1387b2
0 rows in set. Elapsed: 0.027 sec.
Received exception from server (version 22.6.1):
Code: 153. DB::Exception: Received from localhost:9000. DB::Exception: Division by zero: while executing 'FUNCTION and(greaterOrEquals(number, 0) :: 3, if(notEquals(number, 0), intDiv(1, number), 1) :: 0) -> and(greaterOrEquals(number, 0), if(notEquals(number, 0), intDiv(1, number), 1)) UInt8 : 2'. (ILLEGAL_DIVISION) Although: select if(number != 0, intDiv(1, number), 1) from numbers(5)
SELECT if(number != 0, intDiv(1, number), 1)
FROM numbers(5)
Query id: 2bc813e0-17c7-4fb3-967c-ea7f19764430
┌─if(notEquals(number, 0), intDiv(1, number), 1)─┐
│ 1 │
│ 1 │
│ 0 │
│ 0 │
│ 0 │
└────────────────────────────────────────────────┘ Investigating. UPD: found a bug, will fix it. |
Hi @Avogar , thanks! |
Hi, I'm trying to filter by a encrypted column depending on a condition, but if statement is not working correctly and seems that the column is decrypted with both algorithms before checking the if statement. The table is partitioned by datetime, and it's only failing when datetime filters are also applied to the query.
Here's an example:
SELECT count() FROM data_table WHERE (if(has(array, 'a'), decrypt('aes-256-gcm', encrypted_column, 'key', 'iv'), decrypt('aes-256-cfb128', encrypted_column, 'key')) = 'value1') AND (datetime >= toDateTime('2022-06-14 05:35:36')) AND (datetime < toDateTime('2022-06-14 05:45:36'))
The error is the following:
DB::Exception: Encrypted data is smaller than the size of additional data for AEAD mode, cannot decrypt.
Which ClickHouse server version to use
21.12.3.32
The text was updated successfully, but these errors were encountered: