[ 
https://issues.apache.org/jira/browse/CALCITE-7038?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17979905#comment-17979905
 ] 

Christian Beikov commented on CALCITE-7038:
-------------------------------------------

The requirement seems a bit arbitrary to me, given that the query does not 
explicitly order by the {{branchProtectionRules}} array value.
I am trying to integrate external data into Calcite and avoid unnecessary 
traversal/conversions as much as possible. SQL databases also have types that 
are not comparable and then throw an error when trying to order by such values 
e.g. ordering by a BLOB usually is not allowed. Don't you think it's worth 
giving this another thought?

On the Java object side, the array is represented as {{java.util.ArrayList}} 
and the struct element is a custom java class that I don't necessarily control. 
AFAIU, I could simply wrap the array list in a {{FakeComparableList}} to 
satisfy the compiler needs, because no comparisons happen, but not sure if the 
struct might not become a problem one day as well.

I certainly can workaround this if you say this is how it's supposed to be, 
though I think it would be for the better to reconsider in light of integrating 
"existing external data".

> EnumerableUncollect unnecessarily assuming fields are Comparable
> ----------------------------------------------------------------
>
>                 Key: CALCITE-7038
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7038
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.39.0
>            Reporter: Christian Beikov
>            Priority: Major
>
> {{EnumerableUncollect}} uses {{JavaRowFormat.LIST}} which unnecessarily 
> requires that all the field values are {{Comparable}} leading to a 
> {{ClassCastException}} when executing a query like e.g. against data that is 
> not fully comparable
> {code:sql}
>         select r.id
>         from GitHubRepository r
>         where not exists (
>           select 1
>           from unnest(r.branchProtectionRules) as br
>           and exists (select 1 from GitHubRepository r)
>         )
> {code}
> Assuming {{branchProtectionRules}} is {{Array(Struct(matchingRefs: 
> Integer))}}. Note that the {{EXISTS}} predicate in the unnest subquery is 
> needed to trigger the failure.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to