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

Vladimir Sitnikov commented on CALCITE-501:
-------------------------------------------

After a couple of tries I realized:
1) Optimizer needs statistics. In order to properly plan indexed access it is 
required to calculate the cardinality and access cost.
2) Even if I implement this costing/index access for ReflectiveSchema, It would 
make very little reuse for my MAT plugin.
3) Cost-based de-correlation seems to have very little use in case optimizer 
does not see "indexed" access paths and the associated costs.
4) "JPA and JDO annotations" are not sufficient. I think both those annotation 
sets lack "statistics annotations" (cardinality, number of nulls, most common 
values, etc)

So I think I would drop my "indexed reflective schema experiments" and try 
implementing similar case directly in my plugin.


> Implement indexed access paths in ReflectiveSchema
> --------------------------------------------------
>
>                 Key: CALCITE-501
>                 URL: https://issues.apache.org/jira/browse/CALCITE-501
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.0.0-incubating
>            Reporter: Vladimir Sitnikov
>            Assignee: Julian Hyde
>
> {{ReflectiveSchema}} is not able to perform indexed scan of a particular 
> collection.
> It would be nice if it could find rows by a given key.
> This would demonstrate the way to implement indexed access path in Calcite: 
> rules, filter matching.
> The sketch API can be as follows:
> {code:java}
>   public static class CatchallSchema {
>     public final Employee[] employees = {
>       new Employee(1, 10, "A", 0f, null),
>       new Employee(2, 10, "Ab", 0f, null),
>       new Employee(3, 10, "Abc", 0f, null),
>       new Employee(4, 10, "Abd", 0f, null),
>     };
> // Return the data
>    public Employee[] findEmployeesByName(String name);
> // or
> // List of indices into "employees" collection
>    public int[] findEmployeesByName(String name);
> }
> {code}
> Alternative solution is to treat {{Map/SortedMap}} somehow in a special way.
> {code:java}
> // When Filter(name=?, Scan) can be transformed to MapGet(name=?)
> public Map<String, Employee> employees;
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to