Class JdbcTest
- java.lang.Object
-
- org.apache.calcite.test.JdbcTest
-
public class JdbcTest extends java.lang.Object
Tests for using Calcite via JDBC.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JdbcTest.AbstractModifiableTable
Abstract base class for implementations ofModifiableTable
.static class
JdbcTest.AbstractModifiableView
Abstract base class for implementations ofModifiableView
.static class
JdbcTest.AutoTempDriver
Mock driver that has a handler that stores the results of each query in a temporary table.static class
JdbcTest.Customer
static class
JdbcTest.Department
static class
JdbcTest.Dependent
static class
JdbcTest.EmpDeptTableFactory
Factory for EMP and DEPT tables.static class
JdbcTest.Employee
static class
JdbcTest.Event
static class
JdbcTest.FoodmartJdbcSchema
static class
JdbcTest.FoodmartSchema
static class
JdbcTest.HandlerDriver
Mock driver that a givenHandler
.static class
JdbcTest.HrSchema
static class
JdbcTest.LingualEmp
static class
JdbcTest.LingualSchema
static class
JdbcTest.Location
static class
JdbcTest.MockDdlDriver
Mock driver that can execute a trivial DDL statement.static class
JdbcTest.MySchema
Schema containing dummy tables.static class
JdbcTest.MySchemaFactory
Schema factory that createsJdbcTest.MySchema
objects.static class
JdbcTest.MyTable
Dummy table.static class
JdbcTest.MyTable2
Another dummy table.static class
JdbcTest.SalesFact
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FOODMART_MODEL
static java.util.List<org.apache.calcite.util.Pair<java.lang.String,java.lang.String>>
FOODMART_QUERIES
static java.lang.String
FOODMART_SCHEMA
static java.lang.String
HR_MODEL
static java.lang.String
HR_SCHEMA
private static java.lang.String[]
QUERIES
static ConnectionSpec
SCOTT
static java.lang.String
SCOTT_MODEL
static java.lang.String
SCOTT_SCHEMA
static java.lang.String
START_OF_GROUP_DATA
-
Constructor Summary
Constructors Constructor Description JdbcTest()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private CalciteAssert.AssertThat
assertWithMacro(java.lang.Class clazz)
private void
checkCustomSchema(java.lang.String url, java.lang.String schemaName)
private void
checkCustomSchemaInFileInPwd(java.lang.String fileName)
private void
checkGetTimestamp(java.sql.Connection con)
private void
checkJdbcSchemaDirectConnection(java.lang.String s)
private static void
checkJoinNWay(int n)
private void
checkLikeToRegex(boolean b, java.lang.String pattern, java.lang.String abc)
private void
checkMapSchemaDirectConnection(java.lang.String s)
private void
checkNullableTimestamp(CalciteAssert.Config config)
void
checkOrderBy(boolean desc, org.apache.calcite.config.NullCollation nullCollation)
private void
checkOrderByDescNullsFirst(CalciteAssert.Config config)
Tests ORDER BY ...private void
checkOrderByDescNullsLast(CalciteAssert.Config config)
Tests ORDER BY ...private void
checkOrderByNulls(CalciteAssert.Config clone)
private void
checkOrderByNullsFirst(CalciteAssert.Config config)
Tests ORDER BY ...private void
checkOrderByNullsLast(CalciteAssert.Config config)
Tests ORDER BY ...private void
checkPreparedOffsetFetch(int offset, int fetch, org.hamcrest.Matcher<? super java.sql.ResultSet> matcher)
private void
checkResultSetMetaData(java.sql.Connection connection, java.lang.String sql)
private void
checkTableFunctionInModel(java.lang.Class clazz)
private void
checkTableMacroInModel(java.lang.Class clazz)
static java.util.List<org.apache.calcite.util.Pair<java.lang.String,java.lang.String>>
getFoodmartQueries()
private java.lang.String
mm(int majorVersion, int minorVersion)
private CalciteAssert.AssertThat
modelWithView(java.lang.String view, java.lang.Boolean modifiable)
private CalciteAssert.AssertQuery
predicate(java.lang.String foo)
private void
pv(java.lang.StringBuilder b, java.lang.String p, java.lang.String v)
private static java.lang.String
q(java.lang.String s)
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.private void
startOfGroupStep1(java.lang.String startOfGroup)
private void
startOfGroupStep2(java.lang.String startOfGroup)
private void
startOfGroupStep3(java.lang.String startOfGroup)
private static java.lang.String
sums(int n, boolean c)
void
testAggMultipleMeasures()
void
testAggregateEmpty()
Tests that SUM and AVG over empty set return null.void
testAggregateFilter()
void
testAggUnnestColumn()
void
testAlmostBushy()
Just short of bushy.void
testAnd3()
Tests 3-way AND.void
testArray()
Tests accessing a column in a JDBC source whose type is ARRAY.void
testArray2()
Tests theCARDINALITY
function applied to an array column.void
testArrayConstructor()
void
testArrayElement()
void
testArrayIndexing()
Tests array index.void
testAutomaticTemporaryTable()
Tests saving query results into temporary tables, perHandler.ResultSink
.void
testBushy()
Tests a query whose best plan is a bushy join.void
testCartesianJoin()
Tests a cartesian product aka cross join.void
testCaseSensitiveSubQueryOracle()
void
testCloneGroupBy()
void
testCloneGroupBy2()
void
testCloneGroupBy2Plan()
Tests plan for a query with 4 tables, 3 joins.void
testCloneQueries()
A selection of queries generated by Mondrian.void
testCloneSchema()
void
testComparingIntAndString()
Test case for [CALCITE-980] different flavors of boolean logic.void
testConnectionProperties()
Test forUnregisteredDriver.getPropertyInfo(String, Properties)
.void
testCorrelatedScalarSubQuery()
void
testCountStar()
Query that reads no columns from either underlying table.void
testCountUnionAll()
Same result (and plan) astestSelectDistinct()
.void
testCurrentTimestamp()
Tests that CURRENT_TIMESTAMP gives different values each time a statement is executed.void
testCustomSchemaDirectConnection()
Connects to a custom schema without writing a model.void
testCustomSchemaInFileInPwd()
Test case for [CALCITE-1360] Custom schema in file in current directory.void
testDialect()
TestsSqlDialect
.void
testDifferentTypesSameFields()
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; aClassCastException
would ensue.void
testDistinctCount()
void
testDistinctCount2()
void
testDistinctCountComposite()
void
testDistinctCountSimple()
void
testEquiThetaJoin()
A join that has both equi and non-equi conditions.void
testExcept()
void
testExistsCorrelated()
void
testExpandViewWithLateralJoin()
Unit test for view expansion with lateral join.void
testExplain()
void
testExplainJoin()
Checks that a 3-way join is re-ordered so that join conditions can be applied.void
testExplainJoin2()
Checks that a 3-way join is re-ordered so that join conditions can be applied.void
testExplainJoin3()
One of the most expensive foodmart queries.void
testExplainJoin4()
Test case for (not yet fixed) [CALCITE-99] Recognize semi-join that has high selectivity and push it down.void
testExplainJoinOrderingWithOr()
Condition involving OR makes this more complex thantestExplainJoin()
.void
testExplicitImplicitSchemaSameName()
void
testExtract()
void
testExtractFromInterval()
void
testExtractMonthFromTimestamp()
void
testExtractOnNullDateField()
void
testExtractYearFromTimestamp()
void
testFetch()
Tests FETCH with no ORDER BY.void
testFetchStar()
void
testFloorDate()
void
testFoodmartLattice()
Tests that a relatively complex query on the foodmart schema creates an in-memory aggregate table and then uses it.void
testFullJoin()
void
testFunOracle()
void
testFunSpatial()
void
testGetByName()
Tests accessing columns by name.void
testGetDate()
Tests accessing a column in a JDBC source whose type is DATE.void
testGetDateAsString()
Tests accessing a date as a string in a JDBC source whose type is DATE.void
testGetTimestamp()
Test for timestamps and time zones, based on pgsql TimezoneTest.void
testGetTimestampObject()
void
testGroupBy1Max1()
Same result (and plan) astestSelectDistinct()
.void
testGroupByMax1IsNull()
Same result (and plan) astestSelectDistinct()
.void
testGroupByNoAggregates()
Same result (and plan) astestSelectDistinct()
.void
testGroupByNoAggregatesAllColumns()
Same result (and plan) astestSelectDistinct()
.void
testGroupByNull()
Tests composite GROUP BY where one of the columns has NULL values.void
testGroupingSets()
void
testHavingNot()
void
testHavingNot2()
Minimal case oftestHavingNot()
.void
testHook()
Tests thatHook.PARSE_TREE
works.void
testIn()
A difficult query: an IN list so large that the planner promotes it to a semi-join against a VALUES relation.void
testInnerJoinValues()
Tests inner join to an inline table (VALUES
clause).void
testIntersect()
void
testIntersectMismatchedVarchar()
void
testIsNotDistinctInFilter()
void
testJanino169()
Janino bug [JANINO-169] running queries against the JDBC adapter.void
testJdbcDate()
Tests a date literal against a JDBC data source.void
testJdbcSchemaDirectConnection()
Connects to a JDBC schema without writing a model.void
testJdbcTimestamp()
Tests a timestamp literal against JDBC data source.void
testJoinCorrelatedScalarSubQuery()
void
testJoinFiveWay()
Four-way join.void
testJoinInCorrelatedSubQuery()
Test case for [CALCITE-313] Query decorrelation fails.void
testJoinJoin()
Test case for [CALCITE-35] Support parenthesized sub-clause in JOIN.void
testJoinManyWay()
Tests a simple (primary key to primary key) N-way join, with arbitrary N.void
testJoinMismatchedVarchar()
Test case for [CALCITE-1153] Invalid CAST when push JOIN down to Oracle.void
testLagDefaultValue()
Tests default value of LAG function.void
testLagExpressionOffset()
Tests expression in offset value of LAG function.void
testLagInvalidOffsetArgument()
Tests DATE as offset argument of LAG function.void
testLateral()
void
testLateralJoin()
Unit test for LATERAL CROSS JOIN to table function.void
testLateralWithOver()
Test case for [CALCITE-531] Window function does not work in LATERAL.void
testLeadDefaultValue()
Tests default value of LEAD function.void
testLeftJoin()
void
testLexCaseInsensitive()
Tests case-insensitive resolution of schema and table names.void
testLexCaseInsensitiveFindsNonexistentTable()
void
testLexCaseInsensitiveSubQueryField()
Tests case-insensitive resolution of sub-query columns.void
testLexCaseInsensitiveTableAlias()
void
testLexJava()
Tests metadata for the JAVA lexical scheme.void
testLexMySQL()
Tests metadata for the MySQL lexical scheme.void
testLexMySQLANSI()
Tests metadata for the MySQL ANSI lexical scheme.void
testLexOracle()
Tests metadata for the ORACLE (and default) lexical scheme.void
testLexOracleAsJava()
Tests metadata for the ORACLE lexical scheme overridden like JAVA.void
testLexSqlServer()
Tests metadata for different the "SQL_SERVER" lexical scheme.void
testLike()
Tests the LIKE operator.void
testLikeToRegex()
Unit test forCalciteMetaImpl.likeToRegex(org.apache.calcite.avatica.Meta.Pat)
.void
testLimitOnQueryableTable()
Limit implemented usingExtendedEnumerable.take(int)
.void
testLimitStar()
Alternative formulation fortestFetchStar()
.void
testLimitZero()
"SELECT ...void
testMapSchemaDirectConnection()
Connects to a map schema without writing a model.void
testMergeJoin()
Tests a merge-join.void
testMetaDataColumns()
Tests driver's implementation ofDatabaseMetaData.getColumns(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
.void
testMetaDataPrimaryKeys()
Tests driver's implementation ofDatabaseMetaData.getPrimaryKeys(java.lang.String, java.lang.String, java.lang.String)
.void
testMetaTables()
Tests the TABLES table in the information schema.void
testMixedEqualAndIsNotDistinctJoin()
void
testMockDdl()
Tests that a driver can be extended with its own parser and can execute its own flavor of DDL.void
testModel()
Tests a JDBC connection that provides a model (a single schema based on a JDBC database).void
testModelCustomSchema()
Tests a JDBC connection that provides a model that contains a custom schema.void
testModelCustomTable()
Tests a JDBC connection that provides a model that contains custom tables.void
testModelCustomTable2()
Tests a JDBC connection that provides a model that contains custom tables.void
testModelCustomTableArrayRowSingleColumn()
Tests a JDBC connection that provides a model that contains custom tables.void
testModelCustomTableIntegerRowSingleColumn()
Tests a JDBC connection that provides a model that contains custom tables.void
testModelImmutableSchemaCannotContainView()
Tests that an immutable schema in a model cannot contain a view.void
testModelView()
Tests a JDBC connection that provides a model that contains a view.void
testModelWithComment()
Tests a JSON model with a comment.void
testModelWithInvalidModifiableView()
Tests a few cases where modifiable views are invalid.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.void
testModelWithModifiableView()
Tests a modifiable view.void
testMultisetConstructor()
void
testMultisetQuery()
void
testMultisetQueryWithSingleColumn()
void
testNestedArray()
Tests JDBC support for nested arrays.void
testNoCalcBetweenJoins()
Makes sure that a projection introduced by a call toJoinCommuteRule
does not manifest as anEnumerableCalc
in the plan.void
testNotExistsCorrelated()
void
testNotExistsCorrelated2()
Manual expansion of EXISTS intestNotExistsCorrelated()
.void
testNotIn()
Tests the NOT IN operator.void
testNotInEmptyQuery()
void
testNotInQuery()
void
testNotInQueryWithNull()
void
testNtile1()
Tests NTILE(2).void
testNtile2()
Tests NTILE(2).void
testNtileConstantArgs()
Tests expression in offset value of LAG function.void
testNtileDecimalArg()
Tests expression in offset value of LAG function.void
testNtileNegativeArg()
Tests expression in offset value of LAG function.void
testNullableNumericColumnInCloneSchema()
Test case for [CALCITE-730] ClassCastException in table from CloneSchema.void
testNullableTimestamp()
There was a bug representing a nullable timestamp using aLong
internally.void
testNullableTimestamp2()
Similar totestNullableTimestamp()
but directly off JDBC.void
testOnConnectionClose()
TestsHandler.onConnectionClose(org.apache.calcite.avatica.AvaticaConnection)
andHandler.onStatementClose(org.apache.calcite.avatica.AvaticaStatement)
.void
testOrderBy()
Tests ORDER BY with no options.void
testOrderByCase()
void
testOrderByCast()
Tests sorting by a CAST expression not in the select clause.void
testOrderByDesc()
Tests ORDER BY ...void
testOrderByExpr()
Tests sorting by an expression not in the select clause.void
testOrderByFetch()
Tests ORDER BY ...void
testOrderByNulls()
Tests ORDER BY with all combinations of ASC, DESC, NULLS FIRST, NULLS LAST.void
testOrderByOffsetFetch()
Tests ORDER BY ...void
testOrderByOnSortedTable()
Tests sorting by a column that is already sorted.void
testOrderByOnSortedTable2()
Tests sorting by a column that is already sorted.void
testOrderByVarious()
Tests ORDER BY ...void
testOrderByView()
Tests a view with ORDER BY and LIMIT clauses.void
testOrderOnSortedTable()
ORDER BY on a sort-key does not require a sort.void
testOrderSorted()
ORDER BY on a sort-key does not require a sort.void
testOrderStarByExpr()
Tests sorting by an expression not in the '*' select clause.void
testOrderUnionStarByExpr()
void
testOverNoOrder()
Tests windowed aggregation with no ORDER BY clause.void
testOverUnboundedPreceding()
Tests UNBOUNDED PRECEDING clause.void
testPreparedOffsetFetch()
Test case for [CALCITE-2061] Dynamic parameters in offset/fetch.void
testPreparedStatement()
Tests aPreparedStatement
with parameters.void
testPrimitiveColumnsWithNullValues()
void
testQueryWithParameter()
void
testQuotedCaseSensitiveSubQueryMySql()
void
testQuotedCaseSensitiveSubQuerySqlServer()
private void
testRangeTable(java.lang.String elementType)
void
testReadme()
The example in the README.void
testReduceCompositeCountNotNullable()
Tests thatcount(deptno, commission, commission + 1)
is reduced tocount(commission, commission + 1)
, because deptno is NOT NULL.void
testReduceCountNotNullable()
Tests that count(deptno) is reduced to count().void
testResultSetMetaData()
Tests driver's implementation ofDatabaseMetaData.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,void
testReuseExpressionWhenNullChecking()
void
testReuseExpressionWhenNullChecking2()
void
testReuseExpressionWhenNullChecking3()
void
testReuseExpressionWhenNullChecking4()
void
testReuseExpressionWhenNullChecking5()
void
testRightJoin()
void
testRollup()
void
testRowComparison()
void
testScalarSubQuery()
Tests a correlated scalar sub-query in the SELECT clause.void
testScalarSubQueryInCase()
void
testScalarSubQueryInCase2()
void
testScalarSubQueryUncorrelated()
void
testSchemaCaching()
void
testSelectDistinct()
void
testSelectDistinctComposite()
Select distinct on composite key, one column of which is boolean to boot.void
testSelectDistinctStar()
void
testSelectWithoutFrom()
Test case for [CALCITE-1120] Support SELECT without FROM.void
testSelfJoin()
Unit test for self-join.void
testSelfJoinCount()
Limit implemented usingExtendedEnumerable.take(int)
.void
testSelfJoinDifferentColumns()
Self-join on different columns, select a different column, and sort and limit on yet another column.void
testSelfReferentialView()
Test case for [CALCITE-1900] Improve error message for cyclic views.void
testSelfReferentialView2()
void
testSetMaxRows()
Tests thatStatement.setMaxRows(int)
is honored.void
testSimple()
Tests some queries that have expedited processing because connection pools like to use them to check whether the connection is alive.void
testSimpleCalciteSchema()
void
testSimpleCalciteSchemaWithView()
void
testSimpleIn()
Tests a simple IN query implemented as a semi-join.void
testSql92JoinParenthesized()
Query that uses parenthesized JOIN.void
testStartOfGroupLagStep1()
Tests start_of_group approach for grouping of adjacent intervals.void
testStartOfGroupLagStep3()
Tests start_of_group approach for grouping of adjacent intervals.void
testStartOfGroupLagValueStep2()
Tests start_of_group approach for grouping of adjacent intervals.void
testStartOfGroupLastValueStep1()
Tests start_of_group approach for grouping of adjacent intervals.void
testStartOfGroupLastValueStep2()
Tests start_of_group approach for grouping of adjacent intervals.void
testStartOfGroupLastValueStep3()
Tests start_of_group approach for grouping of adjacent intervals.void
testStartOfGroupLeadStep1()
Tests start_of_group approach for grouping of adjacent intervals.void
testStartOfGroupLeadStep3()
Tests start_of_group approach for grouping of adjacent intervals.void
testStartOfGroupLeadValueStep2()
Tests start_of_group approach for grouping of adjacent intervals.void
testStatementCloseOnCompletion()
TestsStatement
.closeOnCompletion()
.void
testStaticTableFunctionInModel()
Tests a JDBC connection that provides a model that contains a table function defined as a static method.void
testStaticTableMacroInModel()
Tests a JDBC connection that provides a model that contains a table macro defined as a static method.void
testSumOverPossiblyEmptyWindow()
Tests that sum over possibly empty window is nullable.void
testSumOverUnboundedPreceding()
Tests UNBOUNDED PRECEDING clause.void
testTableFunctionInModel()
Tests a JDBC connection that provides a model that contains a table function.void
testTableMacro()
Tests a relation that is accessed via method syntax.void
testTableMacroInModel()
Tests a JDBC connection that provides a model that contains a table macro.void
testTableMacroMap()
Table macro that takes a MAP as a parameter.void
testTableMacroWithNamedParameters()
Tests a table macro with named and optional parameters.void
testThetaJoin()
void
testTrim()
void
testTrimFields()
Tests that field-trimming creates a project near the table scan.void
testTrimFieldsOver()
Tests that field-trimming creates a project near the table scan, in a query with windowed-aggregation.void
testTrivialSort()
Test case for [CALCITE-1015] OFFSET 0 causes AssertionError.void
testTrue()
void
testUnicode()
void
testUnion()
void
testUnionAll()
void
testUnionWithSameColumnNames()
Tests that even though trivial "rename columns" projection is removed, the query still returns proper column names.void
testUnnestArray()
void
testUnnestArrayColumn()
Per SQL std, UNNEST is implicitly LATERAL.void
testUnnestArrayScalarArray()
void
testUnnestArrayScalarArrayAliased()
void
testUnnestArrayScalarArrayWithOrdinal()
void
testUnnestArrayWithOrdinality()
void
testUnnestItemsInMap()
Test case for [CALCITE-1250] UNNEST applied to MAP data type.void
testUnnestItemsInMapWithNoAliasAndAdditionalArgument()
void
testUnnestItemsInMapWithOrdinality()
void
testUnnestMultiset()
void
testUnnestMultiset2()
void
testUnquotedCaseSensitiveSubQueryMySql()
void
testUnquotedCaseSensitiveSubQuerySqlServer()
void
testUpdateBind()
void
testValues()
void
testValuesAlias()
void
testValuesComposite()
Tests a table constructor that has multiple rows and multiple columns.void
testValuesCompositeRenamed()
Tests that even though trivial "rename columns" projection is removed, the query still returns proper column names.void
testValuesCompositeRenamedSameNames()
Tests that even though trivial "rename columns" projection is removed, the query still returns proper column names.void
testValuesMinus()
void
testVarcharEquals()
void
testVariousOuter()
Various queries against EMP and DEPT, in particular involving composite join conditions in various flavors of outer join.void
testVersion()
Make sure that the properties look sane.void
testWhereInOr()
void
testWhereNot()
void
testWhereNullable()
Tests WHERE comparing a nullable integer with an integer literal.void
testWhereOrAndNullable()
Tests CALCITE-980: Not (C='a' or C='b') causes NPEvoid
testWinAgg()
Tests windowed aggregation.void
testWinAgg2()
Tests windowed aggregation with multiple windows.void
testWinAggConstant()
Tests window aggregate whose argument is a constant.void
testWinAggConstantMultipleConstants()
Tests multiple window aggregates over constants.void
testWinAggDenseRankValues()
Tests for DENSE_RANK with same valuesvoid
testWinAggDenseRankValuesDesc()
Tests for DENSE_RANK with same valuesvoid
testWinAggFirstValue()
Tests for FIRST_VALUEvoid
testWinAggFirstValueDesc()
Tests for FIRST_VALUE descvoid
testWinAggFirstValueEmptyWindow()
Tests for FIRST_VALUE empty windowvoid
testWinAggOrderByConstant()
Tests window aggregate ORDER BY constant.void
testWinAggPartitionByConstant()
Tests window aggregate PARTITION BY constant.void
testWinAggRank()
Tests for RANK and ORDER BY ...void
testWinAggRankValues()
Tests for RANK with same valuesvoid
testWinAggRankValuesDesc()
Tests for RANK with same valuesvoid
testWinAggScalarNonNullPhysType()
Tests that window aggregates work when computed over non-nullableJavaRowFormat.SCALAR
inputs.void
testWinAggScalarNonNullPhysTypePlusOne()
Tests thatLogicalCalc
is implemented properly when input isLogicalWindow
and literal.void
testWinIntervalFrame()
Tests for DATE +- INTERVAL window framevoid
testWinRowNumber()
Tests for ROW_NUMBERvoid
testWithinGroupClause1()
Test case for [CALCITE-2224] WITHIN GROUP clause for aggregate functions.void
testWithinGroupClause2()
void
testWithinGroupClause3()
void
testWithinGroupClause4()
void
testWithinGroupClause5()
void
testWithinGroupClause6()
void
testWithInsideWhereExists()
void
testWithOrderBy()
private CalciteAssert.AssertQuery
withEmpDept(java.lang.String sql)
private CalciteAssert.AssertQuery
withFoodMartQuery(int id)
-
-
-
Field Detail
-
FOODMART_SCHEMA
public static final java.lang.String FOODMART_SCHEMA
-
FOODMART_MODEL
public static final java.lang.String FOODMART_MODEL
-
SCOTT
public static final ConnectionSpec SCOTT
-
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
-
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
-
-
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 typeTable
and the actual returned value implementsTranslatableTable
.- Throws:
java.sql.SQLException
java.lang.ClassNotFoundException
-
testTableMacroMap
public void testTableMacroMap() throws java.sql.SQLException, java.lang.ClassNotFoundException
Table macro that takes a MAP as a parameter.Test case for [CALCITE-588] Allow TableMacro to consume Maps and Collections.
- 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
-
assertWithMacro
private CalciteAssert.AssertThat assertWithMacro(java.lang.Class clazz)
-
checkTableMacroInModel
private void checkTableMacroInModel(java.lang.Class clazz)
-
checkTableFunctionInModel
private void checkTableFunctionInModel(java.lang.Class clazz)
-
testOnConnectionClose
public void testOnConnectionClose() throws java.lang.Exception
TestsHandler.onConnectionClose(org.apache.calcite.avatica.AvaticaConnection)
andHandler.onStatementClose(org.apache.calcite.avatica.AvaticaStatement)
.- Throws:
java.lang.Exception
-
testStatementCloseOnCompletion
public void testStatementCloseOnCompletion() throws java.lang.Exception
TestsStatement
.closeOnCompletion()
.- Throws:
java.lang.Exception
-
testWhereInOr
public void testWhereInOr()
Test case for [CALCITE-2071] Query with IN and OR in WHERE clause returns wrong result. More cases in sub-query.iq.
-
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 forUnregisteredDriver.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 ofDatabaseMetaData.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 ofDatabaseMetaData.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 forCalciteMetaImpl.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 ofDatabaseMetaData.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.
-
testAnd3
public void testAnd3()
Tests 3-way AND.With [CALCITE-127] EnumerableCalcRel can't support 3+ AND conditions, the last condition is ignored and rows with deptno=10 are wrongly returned.
-
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.
-
testExtract
public void testExtract()
-
testExtractMonthFromTimestamp
public void testExtractMonthFromTimestamp()
-
testExtractYearFromTimestamp
public void testExtractYearFromTimestamp()
-
testExtractFromInterval
public void testExtractFromInterval()
-
testExtractOnNullDateField
public void testExtractOnNullDateField()
Test case for [CALCITE-1188] NullPointerException when EXTRACT is applied to NULL date field. The problem occurs when EXTRACT appears in both SELECT and WHERE ... IN clauses, the latter with at least two values.
-
testFloorDate
public void testFloorDate()
-
testTrue
public void testTrue()
-
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.
-
testIsNotDistinctInFilter
public void testIsNotDistinctInFilter()
-
testMixedEqualAndIsNotDistinctJoin
public void testMixedEqualAndIsNotDistinctJoin()
-
testEquiThetaJoin
public void testEquiThetaJoin()
A join that has both equi and non-equi conditions.Test case for [CALCITE-371] Cannot implement JOIN whose ON clause contains mixed equi and theta.
-
testThetaJoin
public void testThetaJoin()
-
testJoinJoin
public void testJoinJoin()
Test case for [CALCITE-35] Support parenthesized sub-clause in JOIN.
-
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 theCARDINALITY
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()
-
testAggUnnestColumn
public void testAggUnnestColumn()
-
testArrayElement
public void testArrayElement()
-
testLateral
public void testLateral()
-
testLateralWithOver
public void testLateralWithOver()
Test case for [CALCITE-531] Window function does not work in LATERAL.
-
testUnnestArrayColumn
public void testUnnestArrayColumn()
Per SQL std, UNNEST is implicitly LATERAL.
-
testUnnestArrayScalarArray
public void testUnnestArrayScalarArray()
-
testUnnestArrayScalarArrayAliased
public void testUnnestArrayScalarArrayAliased()
-
testUnnestArrayScalarArrayWithOrdinal
public void testUnnestArrayScalarArrayWithOrdinal()
-
testUnnestItemsInMap
public void testUnnestItemsInMap() throws java.sql.SQLException
Test case for [CALCITE-1250] UNNEST applied to MAP data type.- Throws:
java.sql.SQLException
-
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
-
testNoCalcBetweenJoins
public void testNoCalcBetweenJoins() throws java.io.IOException
Makes sure that a projection introduced by a call toJoinCommuteRule
does not manifest as anEnumerableCalc
in the plan.Test case for (not yet fixed) [CALCITE-92] Project should be optimized away, not converted to EnumerableCalcRel.
- 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
-
testExplainJoin4
public void testExplainJoin4() throws java.io.IOException
Test case for (not yet fixed) [CALCITE-99] Recognize semi-join that has high selectivity and push it down.- Throws:
java.io.IOException
-
testExplainJoinOrderingWithOr
public void testExplainJoinOrderingWithOr()
Condition involving OR makes this more complex thantestExplainJoin()
.
-
testNullableTimestamp
public void testNullableTimestamp()
There was a bug representing a nullable timestamp using aLong
internally.
-
testNullableTimestamp2
public void testNullableTimestamp2()
Similar totestNullableTimestamp()
but directly off JDBC.
-
checkNullableTimestamp
private void checkNullableTimestamp(CalciteAssert.Config config)
-
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()
-
testSelectWithoutFrom
public void testSelectWithoutFrom()
Test case for [CALCITE-1120] Support SELECT without FROM.
-
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.
-
testOrderStarByExpr
public void testOrderStarByExpr()
Tests sorting by an expression not in the '*' select clause. Test case for [CALCITE-176] ORDER BY expression doesn't work with SELECT *.
-
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.
-
checkOrderByNulls
private void checkOrderByNulls(CalciteAssert.Config clone)
-
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 ofCalciteConnectionConfig.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 fortestFetchStar()
.
-
testLimitOnQueryableTable
public void testLimitOnQueryableTable()
Limit implemented usingExtendedEnumerable.take(int)
. Test case for [CALCITE-96] LIMIT against a table in a clone schema causes UnsupportedOperationException.
-
testSelfJoinCount
public void testSelfJoinCount()
Limit implemented usingExtendedEnumerable.take(int)
. Test case for [CALCITE-70] Joins seem to be very expensive in memory.
-
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()
-
testSelectDistinctStar
public void testSelectDistinctStar()
-
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) astestSelectDistinct()
.
-
testGroupByNoAggregatesAllColumns
public void testGroupByNoAggregatesAllColumns()
Same result (and plan) astestSelectDistinct()
.
-
testGroupByMax1IsNull
public void testGroupByMax1IsNull()
Same result (and plan) astestSelectDistinct()
.
-
testGroupBy1Max1
public void testGroupBy1Max1()
Same result (and plan) astestSelectDistinct()
.
-
testHavingNot
public void testHavingNot() throws java.io.IOException
- Throws:
java.io.IOException
-
testHavingNot2
public void testHavingNot2() throws java.io.IOException
Minimal case oftestHavingNot()
.- 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) astestSelectDistinct()
.
-
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 thatcount(deptno, commission, commission + 1)
is reduced tocount(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-nullableJavaRowFormat.SCALAR
inputs. Window aggregates use temporary buffers, thus need to check if primitives are properly boxed and un-boxed.
-
testWinAggScalarNonNullPhysTypePlusOne
public void testWinAggScalarNonNullPhysTypePlusOne()
Tests thatLogicalCalc
is implemented properly when input isLogicalWindow
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.
-
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
-
testComparingIntAndString
public void testComparingIntAndString() throws java.lang.Exception
Test case for [CALCITE-980] different flavors of boolean logic.- Throws:
java.lang.Exception
- See Also:
sql/conditions.iq
-
testTrivialSort
public void testTrivialSort()
Test case for [CALCITE-1015] OFFSET 0 causes AssertionError.
-
testLike
public void testLike()
Tests the LIKE operator.
-
testArrayIndexing
public void testArrayIndexing()
Tests array index.
-
testVarcharEquals
public void testVarcharEquals()
-
testJoinMismatchedVarchar
public void testJoinMismatchedVarchar()
Test case for [CALCITE-1153] Invalid CAST when push JOIN down to Oracle.
-
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()
-
predicate
private CalciteAssert.AssertQuery predicate(java.lang.String foo)
-
testExistsCorrelated
public void testExistsCorrelated()
-
testNotExistsCorrelated
public void testNotExistsCorrelated()
-
testNotExistsCorrelated2
public void testNotExistsCorrelated2()
Manual expansion of EXISTS intestNotExistsCorrelated()
.
-
testJoinInCorrelatedSubQuery
public void testJoinInCorrelatedSubQuery()
Test case for [CALCITE-313] Query decorrelation fails.
-
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.
-
testJoinCorrelatedScalarSubQuery
public void testJoinCorrelatedScalarSubQuery() throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
testCorrelatedScalarSubQuery
public void testCorrelatedScalarSubQuery() throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
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).
-
withEmpDept
private CalciteAssert.AssertQuery withEmpDept(java.lang.String sql)
-
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 thatStatement.setMaxRows(int)
is honored.- Throws:
java.lang.Exception
-
testPreparedStatement
public void testPreparedStatement() throws java.lang.Exception
Tests aPreparedStatement
with parameters.- Throws:
java.lang.Exception
-
testPreparedOffsetFetch
public void testPreparedOffsetFetch() throws java.lang.Exception
Test case for [CALCITE-2061] Dynamic parameters in offset/fetch.- 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).
-
testModelWithComment
public void testModelWithComment()
Tests a JSON model with a comment. Not standard JSON, but harmless to allow Jackson's comments extension.Test case for [CALCITE-160] Allow comments in schema definitions.
-
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 inMaterializationTest
.
-
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
-
testCustomSchemaInFileInPwd
public void testCustomSchemaInFileInPwd() throws java.sql.SQLException
Test case for [CALCITE-1360] Custom schema in file in current directory.- Throws:
java.sql.SQLException
-
checkCustomSchemaInFileInPwd
private void checkCustomSchemaInFileInPwd(java.lang.String fileName) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
testCustomSchemaDirectConnection
public void testCustomSchemaDirectConnection() throws java.lang.Exception
Connects to a custom schema without writing a model.Test case for [CALCITE-1259] Allow connecting to a single schema without writing a model.
- Throws:
java.lang.Exception
-
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
-
testSelfReferentialView
public void testSelfReferentialView() throws java.lang.Exception
Test case for [CALCITE-1900] Improve error message for cyclic views. Previously got aStackOverflowError
.- 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, perHandler.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; aClassCastException
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
-
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.
-
testLexCaseInsensitiveFindsNonexistentTable
public void testLexCaseInsensitiveFindsNonexistentTable()
-
testLexCaseInsensitiveSubQueryField
public void testLexCaseInsensitiveSubQueryField()
Tests case-insensitive resolution of sub-query columns.Test case for [CALCITE-550] Case-insensitive matching of sub-query columns fails.
-
testLexCaseInsensitiveTableAlias
public void testLexCaseInsensitiveTableAlias()
-
testFunOracle
public void testFunOracle()
-
testFunSpatial
public void testFunSpatial()
-
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 thatHook.PARSE_TREE
works.
-
testDialect
public void testDialect()
TestsSqlDialect
.
-
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()
-
testPrimitiveColumnsWithNullValues
public void testPrimitiveColumnsWithNullValues() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testUpdateBind
public void testUpdateBind() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testNullableNumericColumnInCloneSchema
public void testNullableNumericColumnInCloneSchema()
Test case for [CALCITE-730] ClassCastException in table from CloneSchema.
-
testAggMultipleMeasures
public void testAggMultipleMeasures() throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
testWithinGroupClause1
public void testWithinGroupClause1()
Test case for [CALCITE-2224] WITHIN GROUP clause for aggregate functions.
-
testWithinGroupClause2
public void testWithinGroupClause2()
-
testWithinGroupClause3
public void testWithinGroupClause3()
-
testWithinGroupClause4
public void testWithinGroupClause4()
-
testWithinGroupClause5
public void testWithinGroupClause5()
-
testWithinGroupClause6
public void testWithinGroupClause6()
-
testQueryWithParameter
public void testQueryWithParameter() throws java.lang.Exception
Test case for [CALCITE-2609] Dynamic parameters ("?") pushed to underlying JDBC schema, causing error.- Throws:
java.lang.Exception
-
sums
private static java.lang.String sums(int n, boolean c)
-
-