[
https://issues.apache.org/jira/browse/CALCITE-2439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16567504#comment-16567504
]
Vladimir Sitnikov commented on CALCITE-2439:
--------------------------------------------
{quote}I assume that {{getHintsToFilter}} returns multiple rows – one row per
hint – but each row contains in its {{names}} column all of the possible names.
A kind of cartesian product{quote}
I am not following you. {{names}} is just a fully qualified name of the
identifier. There's no cartesian product there. It is just an ID.
The interesting question is what client should do in case like
{code:sql}select * from s^{code}
Suppose {{sales.emp}} follows. Should it append the hint as is?
If so, what should it do in case like?
{code:sql}select * from sales.e^{code}
The completion is again {{sales.emp}}, however client should not produce {{from
sales.sales.emp}}, yet "replacement word would be {{e}} and the hint would be
{{sales.emp}}"
> 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)