Class JdbcTest


  • public class JdbcTest
    extends java.lang.Object
    Tests for using Calcite via JDBC.
    • Field Detail

      • FOODMART_SCHEMA

        public static final java.lang.String FOODMART_SCHEMA
      • FOODMART_MODEL

        public static final java.lang.String FOODMART_MODEL
      • SCOTT_SCHEMA

        public static final java.lang.String SCOTT_SCHEMA
      • SCOTT_MODEL

        public static final java.lang.String SCOTT_MODEL
      • HR_SCHEMA

        public static final java.lang.String HR_SCHEMA
      • HR_MODEL

        public static final java.lang.String HR_MODEL
      • FOODMART_SCOTT_MODEL

        public static final java.lang.String FOODMART_SCOTT_MODEL
      • START_OF_GROUP_DATA

        public static final java.lang.String START_OF_GROUP_DATA
        See Also:
        Constant Field Values
      • QUERIES

        private static final java.lang.String[] QUERIES
      • FOODMART_QUERIES

        public static final java.util.List<org.apache.calcite.util.Pair<java.lang.String,​java.lang.String>> FOODMART_QUERIES
    • Constructor Detail

      • JdbcTest

        public JdbcTest()
    • Method Detail

      • q

        private static java.lang.String q​(java.lang.String s)
      • getFoodmartQueries

        public static java.util.List<org.apache.calcite.util.Pair<java.lang.String,​java.lang.String>> getFoodmartQueries()
      • testModelWithModifiableView

        public void testModelWithModifiableView()
                                         throws java.lang.Exception
        Tests a modifiable view.
        Throws:
        java.lang.Exception
      • testModelWithInvalidModifiableView

        public void testModelWithInvalidModifiableView()
                                                throws java.lang.Exception
        Tests a few cases where modifiable views are invalid.
        Throws:
        java.lang.Exception
      • testTableMacro

        public void testTableMacro()
                            throws java.sql.SQLException,
                                   java.lang.ClassNotFoundException
        Tests a relation that is accessed via method syntax.

        The function (Smalls.view(String) has a return type Table and the actual returned value implements TranslatableTable.

        Throws:
        java.sql.SQLException
        java.lang.ClassNotFoundException
      • testTableMacroWithNamedParameters

        public void testTableMacroWithNamedParameters()
                                               throws java.lang.Exception
        Tests a table macro with named and optional parameters.
        Throws:
        java.lang.Exception
      • testTableMacroInModel

        public void testTableMacroInModel()
                                   throws java.lang.Exception
        Tests a JDBC connection that provides a model that contains a table macro.
        Throws:
        java.lang.Exception
      • testStaticTableMacroInModel

        public void testStaticTableMacroInModel()
                                         throws java.lang.Exception
        Tests a JDBC connection that provides a model that contains a table macro defined as a static method.
        Throws:
        java.lang.Exception
      • testTableFunctionInModel

        public void testTableFunctionInModel()
                                      throws java.lang.Exception
        Tests a JDBC connection that provides a model that contains a table function.
        Throws:
        java.lang.Exception
      • testStaticTableFunctionInModel

        public void testStaticTableFunctionInModel()
                                            throws java.lang.Exception
        Tests a JDBC connection that provides a model that contains a table function defined as a static method.
        Throws:
        java.lang.Exception
      • checkTableMacroInModel

        private void checkTableMacroInModel​(java.lang.Class clazz)
      • checkTableFunctionInModel

        private void checkTableFunctionInModel​(java.lang.Class clazz)
      • testOnConnectionClose

        public void testOnConnectionClose()
                                   throws java.lang.Exception
        Tests Handler.onConnectionClose(org.apache.calcite.avatica.AvaticaConnection) and Handler.onStatementClose(org.apache.calcite.avatica.AvaticaStatement).
        Throws:
        java.lang.Exception
      • testStatementCloseOnCompletion

        public void testStatementCloseOnCompletion()
                                            throws java.lang.Exception
        Tests Statement.closeOnCompletion().
        Throws:
        java.lang.Exception
      • testMockDdl

        public void testMockDdl()
                         throws java.lang.Exception
        Tests that a driver can be extended with its own parser and can execute its own flavor of DDL.
        Throws:
        java.lang.Exception
      • testReadme

        public void testReadme()
                        throws java.lang.ClassNotFoundException,
                               java.sql.SQLException
        The example in the README.
        Throws:
        java.lang.ClassNotFoundException
        java.sql.SQLException
      • testConnectionProperties

        public void testConnectionProperties()
                                      throws java.lang.ClassNotFoundException,
                                             java.sql.SQLException
        Test for UnregisteredDriver.getPropertyInfo(String, Properties).
        Throws:
        java.lang.ClassNotFoundException
        java.sql.SQLException
      • testVersion

        public void testVersion()
                         throws java.lang.ClassNotFoundException,
                                java.sql.SQLException
        Make sure that the properties look sane.
        Throws:
        java.lang.ClassNotFoundException
        java.sql.SQLException
      • mm

        private java.lang.String mm​(int majorVersion,
                                    int minorVersion)
      • testMetaDataColumns

        public void testMetaDataColumns()
                                 throws java.lang.ClassNotFoundException,
                                        java.sql.SQLException
        Tests driver's implementation of DatabaseMetaData.getColumns(java.lang.String, java.lang.String, java.lang.String, java.lang.String).
        Throws:
        java.lang.ClassNotFoundException
        java.sql.SQLException
      • testMetaDataPrimaryKeys

        public void testMetaDataPrimaryKeys()
                                     throws java.lang.ClassNotFoundException,
                                            java.sql.SQLException
        Tests driver's implementation of DatabaseMetaData.getPrimaryKeys(java.lang.String, java.lang.String, java.lang.String). It is empty but it should still have column definitions.
        Throws:
        java.lang.ClassNotFoundException
        java.sql.SQLException
      • testLikeToRegex

        public void testLikeToRegex()
        Unit test for CalciteMetaImpl.likeToRegex(org.apache.calcite.avatica.Meta.Pat).
      • checkLikeToRegex

        private void checkLikeToRegex​(boolean b,
                                      java.lang.String pattern,
                                      java.lang.String abc)
      • testResultSetMetaData

        public void testResultSetMetaData()
                                   throws java.lang.ClassNotFoundException,
                                          java.sql.SQLException
        Tests driver's implementation of DatabaseMetaData.getColumns(java.lang.String, java.lang.String, java.lang.String, java.lang.String), and also [CALCITE-1222] DatabaseMetaData.getColumnLabel returns null when query has ORDER BY,
        Throws:
        java.lang.ClassNotFoundException
        java.sql.SQLException
      • checkResultSetMetaData

        private void checkResultSetMetaData​(java.sql.Connection connection,
                                            java.lang.String sql)
                                     throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testSimple

        public void testSimple()
        Tests some queries that have expedited processing because connection pools like to use them to check whether the connection is alive.
      • testGetByName

        public void testGetByName()
                           throws java.lang.Exception
        Tests accessing columns by name.
        Throws:
        java.lang.Exception
      • testCloneSchema

        public void testCloneSchema()
                             throws java.lang.ClassNotFoundException,
                                    java.sql.SQLException
        Throws:
        java.lang.ClassNotFoundException
        java.sql.SQLException
      • testCloneGroupBy

        public void testCloneGroupBy()
      • testCloneGroupBy2

        public void testCloneGroupBy2()
      • testCloneGroupBy2Plan

        public void testCloneGroupBy2Plan()
        Tests plan for a query with 4 tables, 3 joins.
      • testOrderByCase

        public void testOrderByCase()
      • testAlmostBushy

        public void testAlmostBushy()
        Just short of bushy.
      • testBushy

        public void testBushy()
        Tests a query whose best plan is a bushy join. First join sales_fact_1997 to customer; in parallel join product to product_class; then join the results.
      • testJanino169

        public void testJanino169()
        Janino bug [JANINO-169] running queries against the JDBC adapter. The bug is not present with janino-3.0.9 so the workaround in EnumerableRelImplementor was removed.
      • testJdbcDate

        public void testJdbcDate()
        Tests a date literal against a JDBC data source.
      • testJdbcTimestamp

        public void testJdbcTimestamp()
        Tests a timestamp literal against JDBC data source.
      • testExtractMonthFromTimestamp

        public void testExtractMonthFromTimestamp()
      • testExtractYearFromTimestamp

        public void testExtractYearFromTimestamp()
      • testExtractFromInterval

        public void testExtractFromInterval()
      • testFloorDate

        public void testFloorDate()
      • testSelfJoin

        public void testSelfJoin()
        Unit test for self-join. Left and right children of the join are the same relational expression.
      • testSelfJoinDifferentColumns

        public void testSelfJoinDifferentColumns()
        Self-join on different columns, select a different column, and sort and limit on yet another column.
      • testJoinFiveWay

        public void testJoinFiveWay()
        Four-way join. Used to take 80 seconds.
      • testJoinManyWay

        public void testJoinManyWay()
        Tests a simple (primary key to primary key) N-way join, with arbitrary N.
      • checkJoinNWay

        private static void checkJoinNWay​(int n)
      • querify

        private static java.util.List<org.apache.calcite.util.Pair<java.lang.String,​java.lang.String>> querify​(java.lang.String[] queries1)
        Returns a list of (query, expected) pairs. The expected result is sometimes null.
      • testCloneQueries

        public void testCloneQueries()
        A selection of queries generated by Mondrian.
      • testArray

        public void testArray()
                       throws java.lang.Exception
        Tests accessing a column in a JDBC source whose type is ARRAY.
        Throws:
        java.lang.Exception
      • testArray2

        public void testArray2()
        Tests the CARDINALITY function applied to an array column.
      • testNestedArray

        public void testNestedArray()
                             throws java.lang.Exception
        Tests JDBC support for nested arrays.
        Throws:
        java.lang.Exception
      • testArrayConstructor

        public void testArrayConstructor()
      • testMultisetConstructor

        public void testMultisetConstructor()
      • testMultisetQuery

        public void testMultisetQuery()
      • testMultisetQueryWithSingleColumn

        public void testMultisetQueryWithSingleColumn()
      • testUnnestArray

        public void testUnnestArray()
      • testUnnestArrayWithOrdinality

        public void testUnnestArrayWithOrdinality()
      • testUnnestMultiset

        public void testUnnestMultiset()
      • testUnnestMultiset2

        public void testUnnestMultiset2()
      • testArrayElement

        public void testArrayElement()
      • testLateral

        public void testLateral()
      • testUnnestArrayColumn

        public void testUnnestArrayColumn()
        Per SQL std, UNNEST is implicitly LATERAL.
      • testUnnestArrayScalarArray

        public void testUnnestArrayScalarArray()
      • testUnnestArrayScalarArrayAliased

        public void testUnnestArrayScalarArrayAliased()
      • testUnnestArrayScalarArrayWithOrdinal

        public void testUnnestArrayScalarArrayWithOrdinal()
      • testUnnestItemsInMapWithOrdinality

        public void testUnnestItemsInMapWithOrdinality()
                                                throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testUnnestItemsInMapWithNoAliasAndAdditionalArgument

        public void testUnnestItemsInMapWithNoAliasAndAdditionalArgument()
                                                                  throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • withFoodMartQuery

        private CalciteAssert.AssertQuery withFoodMartQuery​(int id)
                                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • testExplainJoin

        public void testExplainJoin()
        Checks that a 3-way join is re-ordered so that join conditions can be applied. The plan must not contain cartesian joins. JoinPushThroughJoinRule makes this possible.
      • testExplainJoin2

        public void testExplainJoin2()
                              throws java.io.IOException
        Checks that a 3-way join is re-ordered so that join conditions can be applied. The plan is left-deep (agg_c_14_sales_fact_1997 the most rows, then time_by_day, then store). This makes for efficient hash-joins.
        Throws:
        java.io.IOException
      • testExplainJoin3

        public void testExplainJoin3()
                              throws java.io.IOException
        One of the most expensive foodmart queries.
        Throws:
        java.io.IOException
      • testFoodmartLattice

        public void testFoodmartLattice()
                                 throws java.io.IOException
        Tests that a relatively complex query on the foodmart schema creates an in-memory aggregate table and then uses it.
        Throws:
        java.io.IOException
      • testExplainJoinOrderingWithOr

        public void testExplainJoinOrderingWithOr()
        Condition involving OR makes this more complex than testExplainJoin().
      • testNullableTimestamp

        public void testNullableTimestamp()
        There was a bug representing a nullable timestamp using a Long internally.
      • testNullableTimestamp2

        public void testNullableTimestamp2()
        Similar to testNullableTimestamp() but directly off JDBC.
      • testReuseExpressionWhenNullChecking

        public void testReuseExpressionWhenNullChecking()
      • testReuseExpressionWhenNullChecking2

        public void testReuseExpressionWhenNullChecking2()
      • testReuseExpressionWhenNullChecking3

        public void testReuseExpressionWhenNullChecking3()
      • testReuseExpressionWhenNullChecking4

        public void testReuseExpressionWhenNullChecking4()
      • testReuseExpressionWhenNullChecking5

        public void testReuseExpressionWhenNullChecking5()
      • testValues

        public void testValues()
      • testValuesAlias

        public void testValuesAlias()
      • testValuesMinus

        public void testValuesMinus()
      • testValuesComposite

        public void testValuesComposite()
        Tests a table constructor that has multiple rows and multiple columns.

        Note that the character literals become CHAR(3) and that the first is correctly rendered with trailing spaces: 'a '. If we were inserting into a VARCHAR column the behavior would be different; the literals would be converted into VARCHAR(3) values and the implied cast from CHAR(1) to CHAR(3) that appends trailing spaces does not occur. See "contextually typed value specification" in the SQL spec.

      • testValuesCompositeRenamed

        public void testValuesCompositeRenamed()
        Tests that even though trivial "rename columns" projection is removed, the query still returns proper column names.
      • testValuesCompositeRenamedSameNames

        public void testValuesCompositeRenamedSameNames()
        Tests that even though trivial "rename columns" projection is removed, the query still returns proper column names.
      • testUnionWithSameColumnNames

        public void testUnionWithSameColumnNames()
        Tests that even though trivial "rename columns" projection is removed, the query still returns proper column names.
      • testInnerJoinValues

        public void testInnerJoinValues()
        Tests inner join to an inline table (VALUES clause).
      • testMergeJoin

        public void testMergeJoin()
        Tests a merge-join.
      • testCartesianJoin

        public void testCartesianJoin()
        Tests a cartesian product aka cross join.
      • testDistinctCountSimple

        public void testDistinctCountSimple()
      • testDistinctCount2

        public void testDistinctCount2()
      • testDistinctCount

        public void testDistinctCount()
      • testDistinctCountComposite

        public void testDistinctCountComposite()
      • testAggregateFilter

        public void testAggregateFilter()
      • testSimpleIn

        public void testSimpleIn()
        Tests a simple IN query implemented as a semi-join.
      • testIn

        public void testIn()
        A difficult query: an IN list so large that the planner promotes it to a semi-join against a VALUES relation.
      • testSql92JoinParenthesized

        public void testSql92JoinParenthesized()
        Query that uses parenthesized JOIN.
      • testOrderBy

        public void testOrderBy()
        Tests ORDER BY with no options. Nulls come last.
        See Also:
        AvaticaDatabaseMetaData.nullsAreSortedAtEnd()
      • testOrderByDesc

        public void testOrderByDesc()
        Tests ORDER BY ... DESC. Nulls come first (they come last for ASC).
      • testOrderByExpr

        public void testOrderByExpr()
        Tests sorting by an expression not in the select clause.
      • testOrderUnionStarByExpr

        public void testOrderUnionStarByExpr()
      • testOrderByCast

        public void testOrderByCast()
        Tests sorting by a CAST expression not in the select clause.
      • testOrderByNulls

        public void testOrderByNulls()
        Tests ORDER BY with all combinations of ASC, DESC, NULLS FIRST, NULLS LAST.
      • checkOrderByDescNullsFirst

        private void checkOrderByDescNullsFirst​(CalciteAssert.Config config)
        Tests ORDER BY ... DESC NULLS FIRST.
      • checkOrderByNullsFirst

        private void checkOrderByNullsFirst​(CalciteAssert.Config config)
        Tests ORDER BY ... NULLS FIRST.
      • checkOrderByDescNullsLast

        private void checkOrderByDescNullsLast​(CalciteAssert.Config config)
        Tests ORDER BY ... DESC NULLS LAST.
      • checkOrderByNullsLast

        private void checkOrderByNullsLast​(CalciteAssert.Config config)
        Tests ORDER BY ... NULLS LAST.
      • testOrderByVarious

        public void testOrderByVarious()
        Tests ORDER BY ... with various values of CalciteConnectionConfig.defaultNullCollation().
      • checkOrderBy

        public void checkOrderBy​(boolean desc,
                                 org.apache.calcite.config.NullCollation nullCollation)
      • testOrderByFetch

        public void testOrderByFetch()
        Tests ORDER BY ... FETCH.
      • testOrderByOffsetFetch

        public void testOrderByOffsetFetch()
        Tests ORDER BY ... OFFSET ... FETCH.
      • testFetch

        public void testFetch()
        Tests FETCH with no ORDER BY.
      • testFetchStar

        public void testFetchStar()
      • testLimitZero

        public void testLimitZero()
        "SELECT ... LIMIT 0" is executed differently. A planner rule converts the whole query to an empty rel.
      • testLimitStar

        public void testLimitStar()
        Alternative formulation for testFetchStar().
      • testGroupByNull

        public void testGroupByNull()
        Tests composite GROUP BY where one of the columns has NULL values.
      • testGroupingSets

        public void testGroupingSets()
      • testRollup

        public void testRollup()
      • testSelectDistinct

        public void testSelectDistinct()
      • testSelectDistinctComposite

        public void testSelectDistinctComposite()
        Select distinct on composite key, one column of which is boolean to boot.
      • testGroupByNoAggregates

        public void testGroupByNoAggregates()
        Same result (and plan) as testSelectDistinct().
      • testGroupByNoAggregatesAllColumns

        public void testGroupByNoAggregatesAllColumns()
        Same result (and plan) as testSelectDistinct().
      • testGroupByMax1IsNull

        public void testGroupByMax1IsNull()
        Same result (and plan) as testSelectDistinct().
      • testHavingNot2

        public void testHavingNot2()
                            throws java.io.IOException
        Minimal case of testHavingNot().
        Throws:
        java.io.IOException
      • testOrderOnSortedTable

        public void testOrderOnSortedTable()
                                    throws java.io.IOException
        ORDER BY on a sort-key does not require a sort.
        Throws:
        java.io.IOException
      • testOrderSorted

        public void testOrderSorted()
                             throws java.io.IOException
        ORDER BY on a sort-key does not require a sort.
        Throws:
        java.io.IOException
      • testWhereNot

        public void testWhereNot()
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • testCountStar

        public void testCountStar()
        Query that reads no columns from either underlying table.
      • testCountUnionAll

        public void testCountUnionAll()
        Same result (and plan) as testSelectDistinct().
      • testUnionAll

        public void testUnionAll()
      • testUnion

        public void testUnion()
      • testIntersect

        public void testIntersect()
      • testExcept

        public void testExcept()
      • testAggregateEmpty

        public void testAggregateEmpty()
        Tests that SUM and AVG over empty set return null. COUNT returns 0.
      • testReduceCountNotNullable

        public void testReduceCountNotNullable()
        Tests that count(deptno) is reduced to count().
      • testReduceCompositeCountNotNullable

        public void testReduceCompositeCountNotNullable()
        Tests that count(deptno, commission, commission + 1) is reduced to count(commission, commission + 1), because deptno is NOT NULL.
      • testOrderByOnSortedTable

        public void testOrderByOnSortedTable()
        Tests sorting by a column that is already sorted.
      • testOrderByOnSortedTable2

        public void testOrderByOnSortedTable2()
        Tests sorting by a column that is already sorted.
      • testWithInsideWhereExists

        public void testWithInsideWhereExists()
      • testWithOrderBy

        public void testWithOrderBy()
      • testWinAgg

        public void testWinAgg()
        Tests windowed aggregation.
      • testWinAgg2

        public void testWinAgg2()
        Tests windowed aggregation with multiple windows. One window straddles the current row. Some windows have no PARTITION BY clause.
      • testWinAggScalarNonNullPhysType

        public void testWinAggScalarNonNullPhysType()
        Tests that window aggregates work when computed over non-nullable JavaRowFormat.SCALAR inputs. Window aggregates use temporary buffers, thus need to check if primitives are properly boxed and un-boxed.
      • testWinAggScalarNonNullPhysTypePlusOne

        public void testWinAggScalarNonNullPhysTypePlusOne()
        Tests that LogicalCalc is implemented properly when input is LogicalWindow and literal.
      • testWinAggRank

        public void testWinAggRank()
        Tests for RANK and ORDER BY ... DESCENDING, NULLS FIRST, NULLS LAST.
      • testWinAggRankValues

        public void testWinAggRankValues()
        Tests for RANK with same values
      • testWinAggRankValuesDesc

        public void testWinAggRankValuesDesc()
        Tests for RANK with same values
      • testWinAggDenseRankValues

        public void testWinAggDenseRankValues()
        Tests for DENSE_RANK with same values
      • testWinAggDenseRankValuesDesc

        public void testWinAggDenseRankValuesDesc()
        Tests for DENSE_RANK with same values
      • testWinIntervalFrame

        public void testWinIntervalFrame()
        Tests for DATE +- INTERVAL window frame
      • startOfGroupStep1

        private void startOfGroupStep1​(java.lang.String startOfGroup)
      • startOfGroupStep2

        private void startOfGroupStep2​(java.lang.String startOfGroup)
      • startOfGroupStep3

        private void startOfGroupStep3​(java.lang.String startOfGroup)
      • testStartOfGroupLastValueStep1

        public void testStartOfGroupLastValueStep1()
        Tests start_of_group approach for grouping of adjacent intervals. This is a step1, implemented as last_value. http://timurakhmadeev.wordpress.com/2013/07/21/start_of_group/
      • testStartOfGroupLastValueStep2

        public void testStartOfGroupLastValueStep2()
        Tests start_of_group approach for grouping of adjacent intervals. This is a step2, that gets the final group numbers http://timurakhmadeev.wordpress.com/2013/07/21/start_of_group/
      • testStartOfGroupLastValueStep3

        public void testStartOfGroupLastValueStep3()
        Tests start_of_group approach for grouping of adjacent intervals. This is a step3, that aggregates the computed groups http://timurakhmadeev.wordpress.com/2013/07/21/start_of_group/
      • testStartOfGroupLagStep1

        public void testStartOfGroupLagStep1()
        Tests start_of_group approach for grouping of adjacent intervals. This is a step1, implemented as last_value. http://timurakhmadeev.wordpress.com/2013/07/21/start_of_group/
      • testStartOfGroupLagValueStep2

        public void testStartOfGroupLagValueStep2()
        Tests start_of_group approach for grouping of adjacent intervals. This is a step2, that gets the final group numbers http://timurakhmadeev.wordpress.com/2013/07/21/start_of_group/
      • testStartOfGroupLagStep3

        public void testStartOfGroupLagStep3()
        Tests start_of_group approach for grouping of adjacent intervals. This is a step3, that aggregates the computed groups http://timurakhmadeev.wordpress.com/2013/07/21/start_of_group/
      • testStartOfGroupLeadStep1

        public void testStartOfGroupLeadStep1()
        Tests start_of_group approach for grouping of adjacent intervals. This is a step1, implemented as last_value. http://timurakhmadeev.wordpress.com/2013/07/21/start_of_group/
      • testStartOfGroupLeadValueStep2

        public void testStartOfGroupLeadValueStep2()
        Tests start_of_group approach for grouping of adjacent intervals. This is a step2, that gets the final group numbers http://timurakhmadeev.wordpress.com/2013/07/21/start_of_group/
      • testStartOfGroupLeadStep3

        public void testStartOfGroupLeadStep3()
        Tests start_of_group approach for grouping of adjacent intervals. This is a step3, that aggregates the computed groups http://timurakhmadeev.wordpress.com/2013/07/21/start_of_group/
      • testLagDefaultValue

        public void testLagDefaultValue()
        Tests default value of LAG function.
      • testLeadDefaultValue

        public void testLeadDefaultValue()
        Tests default value of LEAD function.
      • testLagExpressionOffset

        public void testLagExpressionOffset()
        Tests expression in offset value of LAG function.
      • testLagInvalidOffsetArgument

        public void testLagInvalidOffsetArgument()
        Tests DATE as offset argument of LAG function.
      • testLagIgnoreNulls

        public void testLagIgnoreNulls()
        Tests LAG function with IGNORE NULLS.
      • testNtile1

        public void testNtile1()
        Tests NTILE(2).
      • testNtile2

        public void testNtile2()
        Tests NTILE(2).
      • testNtileConstantArgs

        public void testNtileConstantArgs()
        Tests expression in offset value of LAG function.
      • testNtileNegativeArg

        public void testNtileNegativeArg()
        Tests expression in offset value of LAG function.
      • testNtileDecimalArg

        public void testNtileDecimalArg()
        Tests expression in offset value of LAG function.
      • testWinAggFirstValue

        public void testWinAggFirstValue()
        Tests for FIRST_VALUE
      • testWinAggFirstValueDesc

        public void testWinAggFirstValueDesc()
        Tests for FIRST_VALUE desc
      • testWinAggFirstValueEmptyWindow

        public void testWinAggFirstValueEmptyWindow()
        Tests for FIRST_VALUE empty window
      • testWinRowNumber

        public void testWinRowNumber()
        Tests for ROW_NUMBER
      • testOverUnboundedPreceding

        public void testOverUnboundedPreceding()
        Tests UNBOUNDED PRECEDING clause.
      • testSumOverUnboundedPreceding

        public void testSumOverUnboundedPreceding()
        Tests UNBOUNDED PRECEDING clause.
      • testSumOverPossiblyEmptyWindow

        public void testSumOverPossiblyEmptyWindow()
        Tests that sum over possibly empty window is nullable.
      • testOverNoOrder

        public void testOverNoOrder()
        Tests windowed aggregation with no ORDER BY clause.

        Test case for [CALCITE-285] Window functions throw exception without ORDER BY.

        Note:

        • With no ORDER BY, the window is over all rows in the partition.
        • With an ORDER BY, the implicit frame is 'RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW'.
        • With no ORDER BY or PARTITION BY, the window contains all rows in the table.
      • testTrimFields

        public void testTrimFields()
                            throws java.lang.Exception
        Tests that field-trimming creates a project near the table scan.
        Throws:
        java.lang.Exception
      • testTrimFieldsOver

        public void testTrimFieldsOver()
                                throws java.lang.Exception
        Tests that field-trimming creates a project near the table scan, in a query with windowed-aggregation.
        Throws:
        java.lang.Exception
      • testWinAggConstant

        public void testWinAggConstant()
        Tests window aggregate whose argument is a constant.
      • testWinAggConstantMultipleConstants

        public void testWinAggConstantMultipleConstants()
        Tests multiple window aggregates over constants. This tests that EnumerableWindowRel is able to reference the right slot when accessing constant for aggregation argument.
      • testWinAggPartitionByConstant

        public void testWinAggPartitionByConstant()
        Tests window aggregate PARTITION BY constant.
      • testWinAggOrderByConstant

        public void testWinAggOrderByConstant()
        Tests window aggregate ORDER BY constant. Unlike in SELECT ... ORDER BY, the constant does not mean a column. It means a constant, therefore the order of the rows is not changed.
      • testWhereNullable

        public void testWhereNullable()
        Tests WHERE comparing a nullable integer with an integer literal.
      • testWhereOrAndNullable

        public void testWhereOrAndNullable()
        Tests CALCITE-980: Not (C='a' or C='b') causes NPE
      • testLike

        public void testLike()
        Tests the LIKE operator.
      • testArrayIndexing

        public void testArrayIndexing()
        Tests array index.
      • testVarcharEquals

        public void testVarcharEquals()
      • testIntersectMismatchedVarchar

        public void testIntersectMismatchedVarchar()
      • testNotIn

        public void testNotIn()
        Tests the NOT IN operator. Problems arose in code-generation because the column allows nulls.
      • testNotInEmptyQuery

        public void testNotInEmptyQuery()
      • testNotInQuery

        public void testNotInQuery()
      • testNotInQueryWithNull

        public void testNotInQueryWithNull()
      • testTrim

        public void testTrim()
      • testExistsCorrelated

        public void testExistsCorrelated()
      • testNotExistsCorrelated

        public void testNotExistsCorrelated()
      • testScalarSubQuery

        public void testScalarSubQuery()
        Tests a correlated scalar sub-query in the SELECT clause.

        Note that there should be an extra row "empid=200; deptno=20; DNAME=null" but left join doesn't work.

      • testLeftJoin

        public void testLeftJoin()
      • testFullJoin

        public void testFullJoin()
      • testRightJoin

        public void testRightJoin()
      • testVariousOuter

        public void testVariousOuter()
        Various queries against EMP and DEPT, in particular involving composite join conditions in various flavors of outer join. Results are verified against MySQL (except full join, which MySQL does not support).
      • testScalarSubQueryUncorrelated

        public void testScalarSubQueryUncorrelated()
      • testScalarSubQueryInCase

        public void testScalarSubQueryInCase()
      • testScalarSubQueryInCase2

        public void testScalarSubQueryInCase2()
      • testMetaTables

        public void testMetaTables()
        Tests the TABLES table in the information schema.
      • testSetMaxRows

        public void testSetMaxRows()
                            throws java.lang.Exception
        Tests that Statement.setMaxRows(int) is honored.
        Throws:
        java.lang.Exception
      • testPreparedStatement

        public void testPreparedStatement()
                                   throws java.lang.Exception
        Tests a PreparedStatement with parameters.
        Throws:
        java.lang.Exception
      • checkPreparedOffsetFetch

        private void checkPreparedOffsetFetch​(int offset,
                                              int fetch,
                                              org.hamcrest.Matcher<? super java.sql.ResultSet> matcher)
                                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testModel

        public void testModel()
        Tests a JDBC connection that provides a model (a single schema based on a JDBC database).
      • testModelWithMaterializedView

        public void testModelWithMaterializedView()
        Defines a materialized view and tests that the query is rewritten to use it, and that the query produces the same result with and without it. There are more comprehensive tests in MaterializationTest.
      • testModelCustomTable

        public void testModelCustomTable()
        Tests a JDBC connection that provides a model that contains custom tables.
      • testModelCustomTable2

        public void testModelCustomTable2()
        Tests a JDBC connection that provides a model that contains custom tables.
      • testModelCustomTableArrayRowSingleColumn

        public void testModelCustomTableArrayRowSingleColumn()
        Tests a JDBC connection that provides a model that contains custom tables.
      • testModelCustomTableIntegerRowSingleColumn

        public void testModelCustomTableIntegerRowSingleColumn()
        Tests a JDBC connection that provides a model that contains custom tables.
      • testRangeTable

        private void testRangeTable​(java.lang.String elementType)
      • testModelCustomSchema

        public void testModelCustomSchema()
                                   throws java.lang.Exception
        Tests a JDBC connection that provides a model that contains a custom schema.
        Throws:
        java.lang.Exception
      • checkCustomSchemaInFileInPwd

        private void checkCustomSchemaInFileInPwd​(java.lang.String fileName)
                                           throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • checkCustomSchema

        private void checkCustomSchema​(java.lang.String url,
                                       java.lang.String schemaName)
                                throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testJdbcSchemaDirectConnection

        public void testJdbcSchemaDirectConnection()
                                            throws java.lang.Exception
        Connects to a JDBC schema without writing a model.
        Throws:
        java.lang.Exception
      • checkJdbcSchemaDirectConnection

        private void checkJdbcSchemaDirectConnection​(java.lang.String s)
                                              throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • pv

        private void pv​(java.lang.StringBuilder b,
                        java.lang.String p,
                        java.lang.String v)
      • testMapSchemaDirectConnection

        public void testMapSchemaDirectConnection()
                                           throws java.lang.Exception
        Connects to a map schema without writing a model.
        Throws:
        java.lang.Exception
      • checkMapSchemaDirectConnection

        private void checkMapSchemaDirectConnection​(java.lang.String s)
                                             throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testModelImmutableSchemaCannotContainView

        public void testModelImmutableSchemaCannotContainView()
                                                       throws java.lang.Exception
        Tests that an immutable schema in a model cannot contain a view.
        Throws:
        java.lang.Exception
      • modelWithView

        private CalciteAssert.AssertThat modelWithView​(java.lang.String view,
                                                       java.lang.Boolean modifiable)
      • testModelView

        public void testModelView()
                           throws java.lang.Exception
        Tests a JDBC connection that provides a model that contains a view.
        Throws:
        java.lang.Exception
      • testOrderByView

        public void testOrderByView()
                             throws java.lang.Exception
        Tests a view with ORDER BY and LIMIT clauses.
        Throws:
        java.lang.Exception
      • testSelfReferentialView2

        public void testSelfReferentialView2()
                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testAutomaticTemporaryTable

        public void testAutomaticTemporaryTable()
                                         throws java.lang.Exception
        Tests saving query results into temporary tables, per Handler.ResultSink.
        Throws:
        java.lang.Exception
      • testExplain

        public void testExplain()
      • testDifferentTypesSameFields

        public void testDifferentTypesSameFields()
                                          throws java.lang.Exception
        Test case for bug where if two tables have different element classes but those classes have identical fields, Calcite would generate code to use the wrong element class; a ClassCastException would ensue.
        Throws:
        java.lang.Exception
      • testCurrentTimestamp

        public void testCurrentTimestamp()
                                  throws java.lang.Exception
        Tests that CURRENT_TIMESTAMP gives different values each time a statement is executed.
        Throws:
        java.lang.Exception
      • testGetTimestamp

        public void testGetTimestamp()
                              throws java.lang.Exception
        Test for timestamps and time zones, based on pgsql TimezoneTest.
        Throws:
        java.lang.Exception
      • checkGetTimestamp

        private void checkGetTimestamp​(java.sql.Connection con)
                                throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testMonthName

        public void testMonthName()
        Test for MONTHNAME and DAYNAME functions in two locales.
      • testGetDate

        public void testGetDate()
                         throws java.lang.Exception
        Tests accessing a column in a JDBC source whose type is DATE.
        Throws:
        java.lang.Exception
      • testGetDateAsString

        public void testGetDateAsString()
                                 throws java.lang.Exception
        Tests accessing a date as a string in a JDBC source whose type is DATE.
        Throws:
        java.lang.Exception
      • testGetTimestampObject

        public void testGetTimestampObject()
                                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testRowComparison

        public void testRowComparison()
      • testUnicode

        public void testUnicode()
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testLexMySQL

        public void testLexMySQL()
                          throws java.lang.Exception
        Tests metadata for the MySQL lexical scheme.
        Throws:
        java.lang.Exception
      • testLexMySQLANSI

        public void testLexMySQLANSI()
                              throws java.lang.Exception
        Tests metadata for the MySQL ANSI lexical scheme.
        Throws:
        java.lang.Exception
      • testLexSqlServer

        public void testLexSqlServer()
                              throws java.lang.Exception
        Tests metadata for different the "SQL_SERVER" lexical scheme.
        Throws:
        java.lang.Exception
      • testLexOracle

        public void testLexOracle()
                           throws java.lang.Exception
        Tests metadata for the ORACLE (and default) lexical scheme.
        Throws:
        java.lang.Exception
      • testLexJava

        public void testLexJava()
                         throws java.lang.Exception
        Tests metadata for the JAVA lexical scheme.
        Throws:
        java.lang.Exception
      • testLexOracleAsJava

        public void testLexOracleAsJava()
                                 throws java.lang.Exception
        Tests metadata for the ORACLE lexical scheme overridden like JAVA.
        Throws:
        java.lang.Exception
      • testLexCaseInsensitive

        public void testLexCaseInsensitive()
        Tests case-insensitive resolution of schema and table names.
      • testLexCaseInsensitiveTableAlias

        public void testLexCaseInsensitiveTableAlias()
      • testFunOracle

        public void testFunOracle()
      • testLateralJoin

        public void testLateralJoin()
        Unit test for LATERAL CROSS JOIN to table function.
      • testExpandViewWithLateralJoin

        public void testExpandViewWithLateralJoin()
        Unit test for view expansion with lateral join.
      • testHook

        public void testHook()
        Tests that Hook.PARSE_TREE works.
      • testDialect

        public void testDialect()
        Tests SqlDialect.
      • testExplicitImplicitSchemaSameName

        public void testExplicitImplicitSchemaSameName()
                                                throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testSimpleCalciteSchema

        public void testSimpleCalciteSchema()
                                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testSimpleCalciteSchemaWithView

        public void testSimpleCalciteSchemaWithView()
                                             throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testSchemaCaching

        public void testSchemaCaching()
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testCaseSensitiveSubQueryOracle

        public void testCaseSensitiveSubQueryOracle()
      • testUnquotedCaseSensitiveSubQueryMySql

        public void testUnquotedCaseSensitiveSubQueryMySql()
      • testQuotedCaseSensitiveSubQueryMySql

        public void testQuotedCaseSensitiveSubQueryMySql()
      • testUnquotedCaseSensitiveSubQuerySqlServer

        public void testUnquotedCaseSensitiveSubQuerySqlServer()
      • testQuotedCaseSensitiveSubQuerySqlServer

        public void testQuotedCaseSensitiveSubQuerySqlServer()
      • testWithinGroupClause2

        public void testWithinGroupClause2()
      • testWithinGroupClause3

        public void testWithinGroupClause3()
      • testWithinGroupClause4

        public void testWithinGroupClause4()
      • testWithinGroupClause5

        public void testWithinGroupClause5()
      • testWithinGroupClause6

        public void testWithinGroupClause6()
      • testMatchSimple

        public void testMatchSimple()
      • testMatch

        public void testMatch()
      • testJsonType

        public void testJsonType()
      • testJsonDepth

        public void testJsonDepth()
      • testJsonLength

        public void testJsonLength()
      • testJsonPretty

        public void testJsonPretty()
      • testJsonKeys

        public void testJsonKeys()
      • testJsonRemove

        public void testJsonRemove()
      • testJsonStorageSize

        public void testJsonStorageSize()
      • sums

        private static java.lang.String sums​(int n,
                                             boolean c)