Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4751

SqlParserImpl.FACTORY does not support infix cast operator ('10'::INT)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • None
    • 1.28.0
    • None
    • None

    Description

      Since I'm struggling with CALCITE-4746 I tried to use the SqlBabelParserImpl.FACTORY instead. Which works fine but then I found another problem.

      It seems that there is no support for the Postgres Infix Cast operator in this ParserImplementation? So trying to run:

              SqlParser.Config c = SqlParser.config()
                      .withParserFactory(SqlParserImpl.FACTORY);
              SqlParser parser = SqlParser.create("SELECT bar::INT FROM foo", c);
              parser.parseQuery();
      

      gives

      org.apache.calcite.sql.parser.SqlParseException: Encountered ":" at line 1, column 13.
      Was expecting one of:
          <EOF> 
          "AS" ...
          "EXCEPT" ...
          "FETCH" ...
          "FROM" ...
          "INTERSECT" ...
          "LIMIT" ...
          "OFFSET" ...
          "ORDER" ...
          "MINUS" ...
          "UNION" ...
          <QUOTED_STRING> ...
          "," ...
          <BRACKET_QUOTED_IDENTIFIER> ...
          <QUOTED_IDENTIFIER> ...
          <BACK_QUOTED_IDENTIFIER> ...
          <HYPHENATED_IDENTIFIER> ...
          <IDENTIFIER> ...
          <UNICODE_QUOTED_IDENTIFIER> ...
          "." ...
          "NOT" ...
          "IN" ...
          "<" ...
          "<=" ...
          ">" ...
          ">=" ...
          "=" ...
          "<>" ...
          "!=" ...
          "BETWEEN" ...
          "LIKE" ...
          "SIMILAR" ...
          "+" ...
          "-" ...
          "*" ...
          "/" ...
          "%" ...
          "||" ...
          "AND" ...
          "OR" ...
          "IS" ...
          "MEMBER" ...
          "SUBMULTISET" ...
          "CONTAINS" ...
          "OVERLAPS" ...
          "EQUALS" ...
          "PRECEDES" ...
          "SUCCEEDS" ...
          "MULTISET" ...
          "[" ...
          "(" ...
      

      Is this intentional or is this a bug?

      Attachments

        Activity

          People

            Unassigned Unassigned
            pineapplefreak Toni Mueller
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: