You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Julian Hyde <jh...@apache.org> on 2016/02/03 23:30:19 UTC

Re: Re-working the metadata framework

The fix has been available for review for a couple of weeks now.

Jacques, Vladimir (and anyone else),

Do you need more time to review? If not I’d like to check in.

Julian

> On Jan 22, 2016, at 2:51 PM, Julian Hyde <jh...@apache.org> wrote:
> 
> 
>> On Jan 22, 2016, at 1:52 PM, Vladimir Sitnikov <si...@gmail.com> wrote:
>> 
>> I want something like
>> 
>> @Setup
>> public void ...
>> 
>> @Benchmark
>> public Object columnUniqueness() {
>> return metadataProvider.getColumnUniqueness(whateverArgs);
>> }
>> 
> 
> RelMetadataTest pretty much does that. Copy it, add the @Benchmark annotations, and maybe move some code into setup methods.
> 
> 
>> Julian> it sounds like you're
>> Julian>talking about perfect hashing
>> 
>> I am.
>> FIY: switch(String) is compiled to switch(s.hashCode()) kind of thing.
>> Well, the requirements are slightly different, thus map might work
>> better for us.
> 
> I did consider using switch (r.getClass().getName()), except that janino doesn’t support it. But since we have all of the Class objects when we are compiling the code, we also know their identity hash codes (i.e. their addresses) and we could construct a perfect hash. We could replace 
> 
>  switch (relClasses.indexOf(r.getClass())
> 
> with
> 
>  switch (System.identityHashCode(r.getClass()) % 137)
> 
> (replacing 137 with some value chosen by an algorithm)
> 
> Julian