use of org.apache.calcite.sql.advise.SqlAdvisorValidator in project flink by apache.
the class ParserImpl method getCompletionHints.
public String[] getCompletionHints(String statement, int cursor) {
List<String> candidates = new ArrayList<>(Arrays.asList(EXTENDED_PARSER.getCompletionHints(statement, cursor)));
// use sql advisor
SqlAdvisorValidator validator = validatorSupplier.get().getSqlAdvisorValidator();
SqlAdvisor advisor = new SqlAdvisor(validator, validatorSupplier.get().config().getParserConfig());
String[] replaced = new String[1];
List<String> sqlHints = advisor.getCompletionHints(statement, cursor, replaced).stream().map(item -> item.toIdentifier().toString()).collect(Collectors.toList());
candidates.addAll(sqlHints);
return candidates.toArray(new String[0]);
}
Aggregations