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

Mihai Budiu commented on CALCITE-7038:
--------------------------------------

I posted the following comment in the wrong issue, and [~julianhyde] has 
replied; here is a copy of the exchange:

Me:

 
This being said, it may be a lot of work to remove the assumption about values 
implementing Comparable; it may be baked into lots of parts of the code.

In our implementation we use a completely different backend, by generating Rust 
code. We also require every value to be comparable, and we rely on the Rust Ord 
trait for that purpose. We have yet to find any problem with that approach - 
all the data structures we needed are properly comparable. A nice benefit of 
this is that it also makes results deterministic if you sort.

Julian:

I agree. In Morel I've made every value comparable, and it has worked out 
nicely. (So much so that we could [simplify the 
syntax|https://github.com/hydromatic/morel/issues/244] of Morel's equivalent of 
the {{ORDER BY}} clause.) If comparisons don't make sense for a particular data 
type - e.g. you can't compare two (latitude, longitude) points - then just 
don't do it.

 

> 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