You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2018/08/02 19:33:00 UTC

[jira] [Comment Edited] (CALCITE-2439) Smart complete for SqlAdvisor

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

Julian Hyde edited comment on CALCITE-2439 at 8/2/18 7:32 PM:
--------------------------------------------------------------

It seems to me that we would need to generate a regexp from "cd". That regexp would determine which of the completions are acceptable.

There is probably a small set of algorithms that make sense in generating that regexp, so we could name those algorithms. For instance:
* the "case-sensitive-prefix" algorithm would generate "^cd.\*"
* the "case-insensitive-prefix" algorithm would generate "(?i)^cd.\*"
* the "camel" algorithm would generate "^c.\*d.\*"

We can build in those algorithms. When people want to use smart completion, they should specify the algorithm that they want to use to generate the regexp.


was (Author: julianhyde):
It seems to me that we would need to generate a regexp from "cd". That regexp would determine which of the completions are acceptable.

There is probably a small set of algorithms that make sense in generating that regexp, so we could name those algorithms. For instance:
* the "case-sensitive-prefix" algorithm would generate "^cd.*"
* the "case-insensitive-prefix" algorithm would generate "(?i)^cd.*"
* the "camel" algorithm would generate "^c.*d.*"

We can build in those algorithms. When people want to use smart completion, they should specify the algorithm that they want to use to generate the regexp.

> Smart complete for SqlAdvisor
> -----------------------------
>
>                 Key: CALCITE-2439
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2439
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.17.0
>            Reporter: Vladimir Sitnikov
>            Assignee: Julian Hyde
>            Priority: Major
>
> Current implementation of SqlAdvisor provides no way to perform smart complete.
> For example,
>  1) A valid completion for {{select cd^ from clients}} might be {{select client_id from clients}}.
>  That is completion is valid if all input characters are represented in final word in a proper sequence.
> 2) Completion might be case-insensitive if all input characters have the same upper/lower case.
> 3) "Contains" might be valid completion option as well. That is {{select id^ from ...}} might be completed to \{{select client_id from...} as well.
> Of course, exact match should be sorted the first, then partial matches and so on.
> It is not clear if smart complete logic belongs to {{SqlAdvisor}} or not. Current client-facing API provides no way to skip default "case-sensitive prefix filtering", so there's no way to implement smart complete at the client side only.
> It is not clear where this logic belongs:
>  a) Ultimate solution would be "skip filtering the identifiers at SqlAdvisor side". Then client can filter and sort the way it wants. The downside of the approach is it would force client to pipe large amount of items across JDBC bridge
>  b) It might be helpful if Calcite had pre-defined implementations that would filter and sort the results. The good part is it simplifies client development, however various clients might have various filters applied.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)