Class SqlSimpleParser

java.lang.Object
org.apache.calcite.sql.advise.SqlSimpleParser

public class SqlSimpleParser extends Object
A simple parser that takes an incomplete and turn it into a syntactically correct statement. It is used in the SQL editor user-interface.
  • Constructor Details

  • Method Details

    • simplifySql

      public String simplifySql(String sql, int cursor)
      Turns a partially completed or syntactically incorrect sql statement into a simplified, valid one that can be passed into getCompletionHints().
      Parameters:
      sql - A partial or syntactically incorrect sql statement
      cursor - to indicate column position in the query at which completion hints need to be retrieved.
      Returns:
      a completed, valid (and possibly simplified SQL statement
    • simplifySql

      public String simplifySql(String sql)
      Turns a partially completed or syntactically incorrect SQL statement into a simplified, valid one that can be validated.
      Parameters:
      sql - A partial or syntactically incorrect sql statement
      Returns:
      a completed, valid (and possibly simplified) SQL statement