[
https://issues.apache.org/jira/browse/CALCITE-5975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17762124#comment-17762124
]
Tanner Clary commented on CALCITE-5975:
---------------------------------------
It looks like that method always throws an {{UnsupportedOperationException}}. I
also see that {{PERCENTILE_DISC}} has an override in {{Aggregate.java}}.
Perhaps adding a similar override for {{PERCENTILE_CONT}} (or allowing it to
use the same as {{PERCENTILE_DISC}}, I am not sure about the specifics}}) could
help fix the problem. I have done some work on these functions so if you open a
fix let me know, I would be happy to help review.
> percentile_cont function throws UnsupportedOperationException
> -------------------------------------------------------------
>
> Key: CALCITE-5975
> URL: https://issues.apache.org/jira/browse/CALCITE-5975
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.35.0
> Reporter: wqn
> Priority: Major
>
> execute a sql like
> {code:java}
> SELECT percentile_cont(0.0005) within group (ORDER BY aa DESC) from
> table{code}
> it throws UnsupportedOperationException
> {code:java}
> Caused by: java.lang.UnsupportedOperationException: null at
> org.apache.calcite.sql.SqlOperatorBinding.getCollationType(SqlOperatorBinding.java:244)
> at
> org.apache.calcite.sql.type.ReturnTypes.lambda$static$25(ReturnTypes.java:1285)
> at
> org.apache.calcite.sql.SqlOperator.inferReturnType(SqlOperator.java:533)
> at org.apache.calcite.rel.core.AggregateCall.create(AggregateCall.java:198)
> at
> org.apache.calcite.tools.RelBuilder$AggCallImpl.aggregateCall(RelBuilder.java:4173)
> at
> org.apache.calcite.tools.RelBuilder.aggregate_(RelBuilder.java:2424)
> at org.apache.calcite.tools.RelBuilder.aggregate(RelBuilder.java:2348)
> at
> org.apache.calcite.sql2rel.RelFieldTrimmer.trimFields(RelFieldTrimmer.java:1102)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498) at
> org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:532) at
> org.apache.calcite.sql2rel.RelFieldTrimmer.dispatchTrimFields(RelFieldTrimmer.java:283)
> at
> org.apache.calcite.sql2rel.RelFieldTrimmer.trimChild(RelFieldTrimmer.java:225)
> at
> org.apache.calcite.sql2rel.RelFieldTrimmer.trimFields(RelFieldTrimmer.java:494)
> at sun.reflect.GeneratedMethodAccessor1005.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:532)
> at
> org.apache.calcite.sql2rel.RelFieldTrimmer.dispatchTrimFields(RelFieldTrimmer.java:283)
> at
> org.apache.calcite.sql2rel.RelFieldTrimmer.trimChild(RelFieldTrimmer.java:225)
> at
> org.apache.calcite.sql2rel.RelFieldTrimmer.trimFields(RelFieldTrimmer.java:824)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:532)
> at
> org.apache.calcite.sql2rel.RelFieldTrimmer.dispatchTrimFields(RelFieldTrimmer.java:283)
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)