-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[CALCITE-6300] Function MAP_VALUES/MAP_KEYS gives exception when mapVauleType and mapKeyType not equals map Biggest mapKeytype or mapValueType #3970
base: main
Are you sure you want to change the base?
Conversation
…auleType and mapKeyType not equals map Biggest mapKeytype or mapValueType
Quality Gate passedIssues Measures |
operandsmap.add(i, operands.get(i)); | ||
} | ||
} | ||
call.setOperand(0, castMapTo(operandsmap)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the question we haven't resolved properly is whether the type checker is allowed to mutate the expression that is being checked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right @mihaibudiu .
Looking a bit in detail, it seems there is already some existing code that calls call.setOperand
on this file, e.g. inside adjustTypeForArrayFunctions
or adjustTypeForMultisetConstructor
; however, these methods seem to be called from a SqlReturnTypeInference
(not from a SqlOperandTypeInference
). Am I correct?
@caicancai would it be possible to adapt this patch so that the new code is contained in a SqlReturnTypeInference
(where there is precedence on Calcite about such modifications)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rubenada ok, My first version of the solution is actually to modify SqlOperandTypeInference.
I will fix this pr later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to think these changes were not wrong as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the ReturnTypeInference is allowed to change the arguments, hopefully this fact is documented somewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will send an email to discuss later. If it is not suitable, I will remove 1.38.0 from this jira.
https://issues.apache.org/jira/browse/CALCITE-6300