Hello,

I am using Calcite 1.36; and I stumbled upon an issue and seeking some 
explanation on the code below in Calcite:

While instantiating SqlParser, the constructor has following line:

parser.switchTo(SqlAbstractParserImpl.LexicalState.forConfig(config));

Essentially it tries to acquire an initial lexical state. However the code 
written inside LexicalState does not handle all the possible values of Quoting. 
For instance, it does not handle Quoting.SINGLE_QUOTE which results in 
assertion error from below code.


  /** Returns the corresponding parser state with the given configuration
   * (in particular, quoting style). */
  public static LexicalState forConfig(SqlParser.Config config) {
    switch (config.quoting()) {
    case BRACKET:
      return DEFAULT;
    case DOUBLE_QUOTE:
      return DQID;
    case BACK_TICK_BACKSLASH:
      return BQID;
    case BACK_TICK:
      if (config.conformance().allowHyphenInUnquotedTableName()
          && config.charLiteralStyles().equals(
              EnumSet.of(CharLiteralStyle.BQ_SINGLE,
                  CharLiteralStyle.BQ_DOUBLE))) {
        return BQID;
      }
      if (!config.conformance().allowHyphenInUnquotedTableName()
          && config.charLiteralStyles().equals(
              EnumSet.of(CharLiteralStyle.STANDARD))) {
        return BTID;
      }
      // fall through
    default:
      throw new AssertionError(config);
    }
  }
}

So how is it supposed to work for Quoting values other than specified in above 
switch case?

I am sure I am missing something basic here. Please help.

Thanks,
Yogi



Reply via email to