Vladimir Sitnikov created CALCITE-2434:
------------------------------------------

             Summary: SqlAdvisor.getCompletionHints does not work for nested 
identifiers sub-match
                 Key: CALCITE-2434
                 URL: https://issues.apache.org/jira/browse/CALCITE-2434
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.17.0
         Environment: Test (SqlAdvisorTest):
{code:java}  @Test public void testNestSchema() throws Exception {
    String sql;
    sql = "select * from sales.n^";
    assertComplete(
        sql,
    ...);
}
{code}

Expected output: "SALES.NEST" schema and tables inside and so on
Actual output: empty.

The thing is it properly uses {{n}} for prefix search, however it uses 
{{hint.toString()}} and it fails for multi-name identifiers:
{code:java}        // Regular identifier. Case-insensitive match.
        for (SqlMoniker hint : completionHints) {
          String cname = hint.toString();
          if ((cname.length() >= word.length())
              && cname.substring(0, word.length()).equalsIgnoreCase(word)) {
            result.add(hint);
          }
        }
{code}

Hints are like "CATALOG.SALES.NEST", and they fail {{cname.substring(0, 
word.length()).equalsIgnoreCase(word)}} check
            Reporter: Vladimir Sitnikov
            Assignee: Julian Hyde






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

Reply via email to