Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

caicancai
Copy link
Member

@caicancai caicancai commented Sep 18, 2024

…auleType and mapKeyType not equals map Biggest mapKeytype or mapValueType
@caicancai
Copy link
Member Author

caicancai commented Sep 18, 2024

@rubenada Looks like my local git crashed for me, I open a new PR. Sorry.
previous discussion: #3847

I have to admit that this solution is a bit ad hoc, my goal is to find a unified solution, since there are many similar questions

Copy link

sonarcloud bot commented Sep 18, 2024

operandsmap.add(i, operands.get(i));
}
}
call.setOperand(0, castMapTo(operandsmap));
Copy link
Contributor

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.

Copy link
Contributor

@rubenada rubenada Sep 19, 2024

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)?

Copy link
Member Author

@caicancai caicancai Sep 20, 2024

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.

Copy link
Contributor

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?

Copy link
Contributor

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

Copy link
Member Author

@caicancai caicancai Sep 21, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants