[CALCITE-6707] Type inference for CHR function is wrong#4067
[CALCITE-6707] Type inference for CHR function is wrong#4067mihaibudiu merged 1 commit intoapache:mainfrom
Conversation
| public static final SqlFunction CHR = | ||
| SqlBasicFunction.create("CHR", | ||
| ReturnTypes.CHAR, | ||
| ReturnTypes.CHAR.andThen(SqlTypeTransforms.TO_NULLABLE), |
There was a problem hiding this comment.
It would be good to extract ReturnTypes.CHAR.andThen(SqlTypeTransforms.TO_NULLABLE) to ReturnTypes how it was done for other return-type inference strategies.
Example for boolean:
/**
* Type-inference strategy whereby the result type of a call is Boolean,
* with nulls allowed if any of the operands allow nulls.
*/
public static final SqlReturnTypeInference BOOLEAN_NULLABLE =
BOOLEAN.andThen(SqlTypeTransforms.TO_NULLABLE);
There was a problem hiding this comment.
I actually think that the naming of these strategies is wrong, "NULLABLE" suggests that the return type is always NULLABLE. It should be called perhaps NULLABLE_IF_NECESSARY.
There was a problem hiding this comment.
I think you are right, but probably NULLABLE_IF_ARGS or NULLABLE_IF_OPERANDS is better.
There are only two hard things in Computer Science: cache invalidation and naming things.
-- Phil Karlton
Lately, I've been thinking that naming is a harder than invalidation 😅
There was a problem hiding this comment.
I have created a new SqlReturnTypeInference, as you have suggested, but I didn't follow the existing naming pattern. I think this name is better.
Signed-off-by: Mihai Budiu <mbudiu@feldera.com>
c09e3d1 to
e3aadc0
Compare
|



No description provided.