10415: Type match between resultType and function's dataType#10472
10415: Type match between resultType and function's dataType#10472walterddr merged 13 commits intoapache:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #10472 +/- ##
============================================
- Coverage 70.21% 68.29% -1.93%
+ Complexity 6116 6106 -10
============================================
Files 2090 2090
Lines 112207 112211 +4
Branches 17078 17079 +1
============================================
- Hits 78784 76629 -2155
- Misses 27857 30093 +2236
+ Partials 5566 5489 -77
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 185 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
| boolean isTypeMatched = functionCall.getDataType() == _resultType.toDataType(); | ||
| Preconditions.checkState(isTypeMatched, "Mismatch function data type and result type"); |
There was a problem hiding this comment.
Pinot's FunctionInvoker largely depending on the next operator's FunctionInvoker parameter type casting
(see:
however we are not guaranteed to have another function invoker chained after.
For this i think we can use functionCall.getDataType() and try to use it to convert _resultType similar to the link above. (it would have performance issues but a good starting point)
please comment on the issue and ask for some specific repo examples so we can add to the test cases
There was a problem hiding this comment.
Thanks for the help. I have a couple of questions.
- For conversion(
parameterType.convert), do I have to convert the_resultType(fieldSpec.DataType) to PinotDataType and perform the conversion or use the conversion functionFieldSpec.convertInternaldirectly. - Second, what should be the outcome of the failing
caswhenquery? It should fail, or with conversion, it should execute without error.
Thanks.
There was a problem hiding this comment.
from my perspective
Thanks for the help. I have a couple of questions.
- For conversion(
parameterType.convert), do I have to convert the_resultType(fieldSpec.DataType) to PinotDataType and perform the conversion or use the conversion functionFieldSpec.convertInternaldirectly.
Either should work. but would go with the safest, which is what FunctionInvoker handles parameter type
- Second, what should be the outcome of the failing
caswhenquery? It should fail, or with conversion, it should execute without error.
it should not fail at all at this stage --> calcite should ensure the resulting data type is consistent. otherwise it will fail in planner before reaching runtime. If the data is not what it said it is (from input) then the failure handling is the same as all other operators
There was a problem hiding this comment.
@walterddr Can you please take a look? Thanks
There was a problem hiding this comment.
thank you will do. i also asked for more examples from @ankitsultana in the original issue. let's wait for a bit and add more test cases
There was a problem hiding this comment.
I think it might be worthwhile to add a couple or so queries which do comparisons of double/float columns with double/float literals, and likewise for int/long columns.
Stuff like:
case longCol > 10
...
case doubleCol < 1.3
case floatCol < 10
..
where longCol < 10 and doubleCol < 1.3 and floatCol < 10...
..
with tmp as (select sum(floatCol) as float_sum from ... group by col1) select * from tmp where float_sum < 10
There was a problem hiding this comment.
I added a couple of test cases, as suggested. Please let me know if I have to add more.
This PR will check the type of the
functionCall.DataTypeand_resultTypeand if it's a mismatch, it will see set the correct oneThis fixes #10415.