Class SqlValidatorTestCase

    • Field Detail

      • EXTENDED_TEST_FACTORY

        private static final SqlTestFactory EXTENDED_TEST_FACTORY
      • EXTENDED_CATALOG_TESTER

        static final SqlTester EXTENDED_CATALOG_TESTER
      • EXTENDED_CATALOG_TESTER_2003

        static final SqlTester EXTENDED_CATALOG_TESTER_2003
      • EXTENDED_CATALOG_TESTER_LENIENT

        static final SqlTester EXTENDED_CATALOG_TESTER_LENIENT
      • TESTER_CONFIGURATION_RULE

        public static final org.junit.rules.MethodRule TESTER_CONFIGURATION_RULE
    • Constructor Detail

      • SqlValidatorTestCase

        public SqlValidatorTestCase()
        Creates a test case.
    • Method Detail

      • getTester

        public SqlTester getTester()
        Returns a tester. Derived classes should override this method to run the same set of tests in a different testing environment.
      • check

        public void check​(java.lang.String sql)
      • checkExp

        public void checkExp​(java.lang.String sql)
      • checkFails

        public final void checkFails​(java.lang.String sql,
                                     java.lang.String expected)
        Checks that a SQL query gives a particular error, or succeeds if expected is null.
      • checkExpFails

        public final void checkExpFails​(java.lang.String sql,
                                        java.lang.String expected)
        Checks that a SQL expression gives a particular error.
      • checkWholeExpFails

        public final void checkWholeExpFails​(java.lang.String sql,
                                             java.lang.String expected)
        Checks that a SQL expression gives a particular error, and that the location of the error is the whole expression.
      • checkExpType

        public final void checkExpType​(java.lang.String sql,
                                       java.lang.String expected)
      • checkColumnType

        public final void checkColumnType​(java.lang.String sql,
                                          java.lang.String expected)
        Checks that a query returns a single column, and that the column has the expected type. For example,
        checkColumnType("SELECT empno FROM Emp", "INTEGER NOT NULL");
        Parameters:
        sql - Query
        expected - Expected type, including nullability
      • checkResultType

        public final void checkResultType​(java.lang.String sql,
                                          java.lang.String expected)
        Checks that a query returns a row of the expected type. For example,
        checkResultType("select empno, name from emp","{EMPNO INTEGER NOT NULL, NAME VARCHAR(10) NOT NULL}");
        Parameters:
        sql - Query
        expected - Expected row type
      • checkIntervalConv

        public final void checkIntervalConv​(java.lang.String sql,
                                            java.lang.String expected)
        Checks that the first column returned by a query has the expected type. For example,
        checkQueryType("SELECT empno FROM Emp", "INTEGER NOT NULL");
        Parameters:
        sql - Query
        expected - Expected type, including nullability
      • assertExceptionIsThrown

        protected final void assertExceptionIsThrown​(java.lang.String sql,
                                                     java.lang.String expectedMsgPattern)
      • checkCharset

        public void checkCharset​(java.lang.String sql,
                                 java.nio.charset.Charset expectedCharset)
      • checkCollation

        public void checkCollation​(java.lang.String sql,
                                   java.lang.String expectedCollationName,
                                   org.apache.calcite.sql.SqlCollation.Coercibility expectedCoercibility)
      • checkEx

        public static void checkEx​(java.lang.Throwable ex,
                                   java.lang.String expectedMsgPattern,
                                   org.apache.calcite.sql.parser.SqlParserUtil.StringAndPos sap)
        Checks whether an exception matches the expected pattern. If sap contains an error location, checks this too.
        Parameters:
        ex - Exception thrown
        expectedMsgPattern - Expected pattern
        sap - Query and (optional) position in query