Class BabelParserTest

  • public class BabelParserTest
    extends SqlParserTest
    Tests the "Babel" SQL parser, that understands all dialects of SQL.
    • Constructor Detail

      • BabelParserTest

        public BabelParserTest()
    • Method Detail

      • parserImplFactory

        protected org.apache.calcite.sql.parser.SqlParserImplFactory parserImplFactory()
        Description copied from class: SqlParserTest
        Implementors of custom parsing logic who want to reuse this test should override this method with the factory for their extension parser.
        parserImplFactory in class SqlParserTest
      • testReservedWords

        public void testReservedWords()
      • testMetadata

        public void testMetadata()

        Copy-pasted from base method, but with some key differences.

        testMetadata in class SqlParserTest
      • testSelect

        public void testSelect()
      • testYearIsNotReserved

        public void testYearIsNotReserved()
      • testKeywords

        public void testKeywords()
        Tests that there are no reserved keywords.
      • testAs

        public void testAs()
        In Babel, AS is not reserved.
        testAs in class SqlParserTest
      • testDesc

        public void testDesc()
        In Babel, DESC is not reserved.
      • testDateFunction

        public void testDateFunction()
        In Redshift, DATE is a function. It requires special treatment in the parser because it is a reserved keyword. (Curiously, TIMESTAMP and TIME are not functions.)
      • testRedshiftFunctionsWithDateParts

        public void testRedshiftFunctionsWithDateParts()
        In Redshift, PostgreSQL the DATEADD, DATEDIFF and DATE_PART functions have ordinary function syntax except that its first argument is a time unit (e.g. DAY). We must not parse that first argument as an identifier.
      • testShortTimestampLiteral

        public void testShortTimestampLiteral()
        PostgreSQL and Redshift allow TIMESTAMP literals that contain only a date part.
      • getTester

        protected SqlParserTest.Tester getTester()
        Babel parser's global LOOKAHEAD is larger than the core parser's. This causes different parse error message between these two parsers. Here we define a looser error checker for Babel, so that we can reuse failure testing codes from SqlParserTest.

        If a test case is written in this file -- that is, not inherited -- it is still checked by SqlParserTest's checker.

        getTester in class SqlParserTest
      • testParseInfixCast

        public void testParseInfixCast()
        Tests parsing PostgreSQL-style "::" cast operator.
      • checkParseInfixCast

        private void checkParseInfixCast​(java.lang.String sqlType)