[CALCITE-7464] Refactor type coercion in array/map functions to avoid mutating operands as side effects#4869
[CALCITE-7464] Refactor type coercion in array/map functions to avoid mutating operands as side effects#4869caicancai wants to merge 1 commit into
Conversation
bc1634b to
d6e97f7
Compare
… mutating operands as side effects
b6e8227 to
aa37529
Compare
|
|
@mihaibudiu If you have time, could you please help follow up on this PR? You should be very clear about the context. |
| opBinding.getTypeFactory(), opBinding.collectOperandTypes()); | ||
|
|
||
| // explicit cast elements to component type if they are not same | ||
| SqlValidatorUtil.adjustTypeForMapConstructor(type, opBinding); |
There was a problem hiding this comment.
Is there a reason SqlValidatorUtil.adjustTypeForArrayConstructor is not considered in this PR?
| if (callBinding.isTypeCoercionEnabled()) { | ||
| callBinding.getValidator().getTypeCoercion() | ||
| .collectionFunctionCoercion(callBinding); | ||
| } |
There was a problem hiding this comment.
might be a breaking change for downstream projects who do not use typeCoercion
imho need at least put info about this in release notes
mihaibudiu
left a comment
There was a problem hiding this comment.
Can we discuss the design first in Jira?
| List<RelDataType> operandTypes, | ||
| List<SqlTypeFamily> expectedFamilies); | ||
|
|
||
| /** |
There was a problem hiding this comment.
Type coercion can depend on functions, it's the other way around: functions can use some services from type coercion.
So I don't understand what this function means.
| @Override public boolean collectionFunctionCoercion(SqlCallBinding binding) { | ||
| final SqlCall call = binding.getCall(); | ||
| switch (call.getKind()) { | ||
| case MAP_VALUE_CONSTRUCTOR: |
There was a problem hiding this comment.
Type coercion cannot depend on various functions like ARRAY_APPEND.
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 90 days if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@calcite.apache.org list. Thank you for your contributions. |



https://issues.apache.org/jira/browse/CALCITE-7464