SqlCompleter { public Map<String, String> findAliasesInSQL(String[] sqlArguments) { Map<String, String> res = new HashMap<>(); for (int i = 0; i < sqlArguments.length - 1; i++) { if (columnsCompleters.keySet().contains(sqlArguments[i]) && sqlArguments[i + 1].matches("[a-zA-Z]+")) { res.put(sqlArguments[i + 1], sqlArguments[i]); } } return res; } SqlCompleter(int ttlInSeconds); int complete(String buffer, int cursor, List<InterpreterCompletion> candidates); static Set<String> getSqlKeywordsCompletions(DatabaseMetaData meta); void createOrUpdateFromConnection(Connection connection, String schemaFiltersString,
      String buffer, int cursor); void initKeywords(Set<String> keywords); void initSchemas(Set<String> schemas); void initTables(String schema, Set<String> tables); void initColumns(String schemaTable, Set<String> columns); Map<String, String> findAliasesInSQL(String[] sqlArguments); int completeName(String buffer, int cursor, List<InterpreterCompletion> candidates,
                          Map<String, String> aliases);  }
@Test public void testFindAliasesInSQL_Simple() { String sql = "select * from prod_emart.financial_account a"; Map<String, String> res = sqlCompleter.findAliasesInSQL( delimiter.delimit(sql, 0).getArguments()); assertEquals(1, res.size()); assertTrue(res.get("a").equals("prod_emart.financial_account")); }