Repository navigation
Allow unknown values in set that are not present in Enum - #72686
Conversation
|
Why do you think it is Backward Incompatible Change? It was not working before at all so there are no queries that will break? |
|
This is an automated comment for commit 69959d1 with description of existing statuses. It's updated for the latest CI running ✅ Click here to open a full report in a separate page Successful checks
|
Maybe the same as you explain, what do you suggest? Improvement is better. Changed to this. |
| catch (...) | ||
| { | ||
| return {}; | ||
| } |
There was a problem hiding this comment.
I think catching any exception here is a bit excessive because such errors still occur in system.errors, which can sometimes be confusing.
More importantly, we can catch logical errors, std exceptions, or memory limit errors. One option to address the second issue is to check the error code for UNKNOWN_ELEMENT_OF_ENUM.
However, a better solution would be to explicitly ensure that when converting a string to an enum, the string is part of the enum values. Since we already have an explicit check for decimal values here, it makes sense to include a similar check for enums.
There was a problem hiding this comment.
Change to UNKNOWN_ELEMENT_OF_ENUM and check type for Enum.
|
I suppose we can adjust the tests that expect errors and allow unconditional conversion without a setting. (but only for enums, I see some failures for other types, because of catching all exceptions). select (255 :: UInt8) as x, x in (256);
┌───x─┬─in(x, 256)─┐
1. │ 255 │ 0 │
└─────┴────────────┘On the other hand: :) select (255 :: UInt8) as x, x in ('a');
Received exception from server (version 24.12.1):
Code: 53. DB::Exception: Received from localhost:9000. DB::Exception: Cannot convert string 'a' to type UInt8. (TYPE_MISMATCH)So, not sure to which case enum is closer. Let's not over-complicate it then, and just allow? |
IMO, I think we can leave it as now, since it's non explicit relation with |
|
@vdimir Wired failed tests, right? |
Seems yes. I cannot merge/rebase your branch, could you please do? |
Update my branch with master now, is there a dead lock in master? |
|
Hi @zhanglistar @vdimir — while reviewing this PR I found the following:
Happy to discuss — close anything that's wrong or already addressed. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Allow unknown values in set that are not present in Enum. Fix #72662
Documentation entry for user-facing changes
CI Settings (Only check the boxes if you know what you are doing):