Fix a logical error for function transform#78247
Conversation
|
The motivation to replace the logical error with a normal one is that the use case, which was originally considered non-reproducible, can actually be reproduced in some rare cases (like in the tests to this PR). |
src/Functions/transform.cpp
Outdated
| ErrorCodes::LOGICAL_ERROR, | ||
| "Fourth argument of function {} must be a constant or a column at least as big as the second and third arguments", | ||
| ErrorCodes::BAD_ARGUMENTS, | ||
| "Fourth argument of function {} must be constant at least as big as the second and third arguments", |
There was a problem hiding this comment.
I'm somewhat confused. From user PoV, the 4-th argument should be just a constant. Telling user that 4-th argument have to have size at all is already confusing. The fact that castColumn() should return a similar size const column is implementation details, — so what exactly are we checking when casting the 4-th argument with castColumn()?
There was a problem hiding this comment.
Telling user that 4-th argument have to have size at all is already confusing
Why it's confusing? We can have the syntax like:
SELECT transform(arg_1, [arg_2], [arg_3], *)
FROM
(
SELECT ...
);Here we can see, what the size of the 4-th argument will be
The fact that castColumn() should return a similar size const column is implementation details, — so what exactly are we checking when casting the 4-th argument with castColumn()?
Your point is valid, I will check not the size of default_non_const, but the arguments[3]
Cherry pick #78247 to 24.8: Fix a logical error for function `transform`
Cherry pick #78247 to 25.2: Fix a logical error for function `transform`
Cherry pick #78247 to 25.3: Fix a logical error for function `transform`
Cherry pick #78247 to 25.4: Fix a logical error for function `transform`
Backport #78247 to 25.4: Fix a logical error for function `transform`
Backport #78247 to 25.3: Fix a logical error for function `transform`
Backport #78247 to 24.8: Fix a logical error for function `transform`
Closes #77805
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix old firing logical error for
transformDocumentation entry for user-facing changes