calcite
calcite copied to clipboard
[CALCITE-6300] Function MAP_VALUES/MAP_KEYS gives exception when mapVauleType and mapKeyType not equals map Biggest mapKeytype or mapValueType
https://issues.apache.org/jira/browse/CALCITE-6300
I may need to add some comments, but the code structure is basically determined
Before I read
adjustTypeForMapFunctionConstructor
, I want to know why we need this method? IfMAP
function throw an exception when component type not equal? Likemap('k1', cast(1 as tinyint), 'k2', cast(1 as bigint))
Thank you for such a quick review, I will write a plan to illustrate it
Here you need to convert mapKeyType and mapValueType into the corresponding Biggest Type. According to the initial method, there is definitely no conversion of mapKeyType and mapValueType into the corresponding Biggest Type.
Why add an adjustTypeForMapFunctionConstructor method
? Here I will give an example:
map_values(map('foo', 1, 'bar', cast(1 as tinyint)))
When performing node parsing, map('foo', 1, 'bar', cast(1 as tinyint)) will be regarded as a node, that is, ((SqlBasicCall) call.getOperandList().get(0))
== map('foo', 1, 'bar', cast(1 as tinyint)),
I have to go through ((SqlBasicCall) call.getOperandList().get(0)).getOperandList() to get what I want, to typecast mapKeyType and mapValueType.
I didn't find the corresponding method, so I wrote a new method
@macroguo-ghy I'm sorry, I made the wrong request. I thought I should resolve the conflict first
Quality Gate passed
Issues
12 New issues
0 Accepted issues
Measures
0 Security Hotspots
93.8% Coverage on New Code
0.0% Duplication on New Code
@macroguo-ghy If you have time, you can help me take a look. I think it is reasonable to only recognize map. Thank you.
@macroguo-ghy If you have time, you can help me take a look. I think it is reasonable to only recognize map. Thank you.
@caicancai Sorry, I'm very busy this week, I will review at the earliest this weekend. And you can ask others for help.
@macroguo-ghy If you have time, you can help me take a look. I think it is reasonable to only recognize map. Thank you.
@caicancai Sorry, I'm very busy this week, I will review at the earliest this weekend. And you can ask others for help.
Small question, this is open source, thank you very much for taking the time to review it for me, I really appreciate it
@mihaibudiu Sorry for following up on this PR so late. If you have time, can you help me review this PR, thank you