Class RelToSqlConverterTest


  • public class RelToSqlConverterTest
    extends java.lang.Object
    Tests for RelToSqlConverter.
    • Field Detail

      • DEFAULT_REL_CONFIG

        static final org.apache.calcite.sql2rel.SqlToRelConverter.Config DEFAULT_REL_CONFIG
      • NO_EXPAND_CONFIG

        static final org.apache.calcite.sql2rel.SqlToRelConverter.Config NO_EXPAND_CONFIG
    • Constructor Detail

      • RelToSqlConverterTest

        public RelToSqlConverterTest()
    • Method Detail

      • getPlanner

        private static org.apache.calcite.tools.Planner getPlanner​(java.util.List<org.apache.calcite.plan.RelTraitDef> traitDefs,
                                                                   org.apache.calcite.sql.parser.SqlParser.Config parserConfig,
                                                                   org.apache.calcite.schema.SchemaPlus schema,
                                                                   org.apache.calcite.sql2rel.SqlToRelConverter.Config sqlToRelConf,
                                                                   org.apache.calcite.tools.Program... programs)
      • jethroDataSqlDialect

        private static org.apache.calcite.sql.dialect.JethroDataSqlDialect jethroDataSqlDialect()
      • mySqlDialect

        private static org.apache.calcite.sql.dialect.MysqlSqlDialect mySqlDialect​(org.apache.calcite.config.NullCollation nullCollation)
      • dialects

        private static java.util.Map<org.apache.calcite.sql.SqlDialect,​org.apache.calcite.sql.SqlDialect.DatabaseProduct> dialects()
        Returns a collection of common dialects, and the database products they represent.
      • relBuilder

        private static org.apache.calcite.tools.RelBuilder relBuilder()
        Creates a RelBuilder.
      • toSql

        private java.lang.String toSql​(org.apache.calcite.rel.RelNode root)
        Converts a relational expression to SQL.
      • toSql

        private static java.lang.String toSql​(org.apache.calcite.rel.RelNode root,
                                              org.apache.calcite.sql.SqlDialect dialect)
        Converts a relational expression to SQL in a given dialect.
      • testSimpleSelectStarFromProductTable

        public void testSimpleSelectStarFromProductTable()
      • testSimpleSelectQueryFromProductTable

        public void testSimpleSelectQueryFromProductTable()
      • testSelectQueryWithWhereClauseOfLessThan

        public void testSelectQueryWithWhereClauseOfLessThan()
      • testSelectQueryWithWhereClauseOfBasicOperators

        public void testSelectQueryWithWhereClauseOfBasicOperators()
      • testSelectQueryWithGroupBy

        public void testSelectQueryWithGroupBy()
      • testSelectQueryWithGroupByEmpty

        public void testSelectQueryWithGroupByEmpty()
      • testSelectQueryWithGroupByEmpty2

        public void testSelectQueryWithGroupByEmpty2()
      • testSelectQueryWithGroupByRollup

        public void testSelectQueryWithGroupByRollup()
        Tests GROUP BY ROLLUP of two columns. The SQL for MySQL has "GROUP BY ... ROLLUP" but no "ORDER BY".
      • testSelectQueryWithSingletonCube

        public void testSelectQueryWithSingletonCube()
        CUBE of one column is equivalent to ROLLUP, and Calcite recognizes this.
      • testSelectQueryWithRollupOrderByCount

        public void testSelectQueryWithRollupOrderByCount()
        Cannot rewrite if ORDER BY contains a column not in GROUP BY (in this case COUNT(*)).
      • testSelectQueryWithMinAggregateFunction

        public void testSelectQueryWithMinAggregateFunction()
      • testSelectQueryWithMinAggregateFunction1

        public void testSelectQueryWithMinAggregateFunction1()
      • testSelectQueryWithSumAggregateFunction

        public void testSelectQueryWithSumAggregateFunction()
      • testSelectQueryWithMultipleAggregateFunction

        public void testSelectQueryWithMultipleAggregateFunction()
      • testSelectQueryWithMultipleAggregateFunction1

        public void testSelectQueryWithMultipleAggregateFunction1()
      • testSelectQueryWithGroupByAndProjectList

        public void testSelectQueryWithGroupByAndProjectList()
      • testCastDecimal1

        public void testCastDecimal1()
      • testWindowedSum0BecomesCoalesce

        public void testWindowedSum0BecomesCoalesce()
        As testSum0BecomesCoalesce() but for windowed aggregates.
      • testSelectQueryWithGroupByAndProjectList1

        public void testSelectQueryWithGroupByAndProjectList1()
      • testSelectQueryWithGroupByHaving

        public void testSelectQueryWithGroupByHaving()
      • testHaving4

        public void testHaving4()
      • testSelectQueryWithOrderByClause

        public void testSelectQueryWithOrderByClause()
      • testSelectQueryWithOrderByClause1

        public void testSelectQueryWithOrderByClause1()
      • testSelectQueryWithTwoOrderByClause

        public void testSelectQueryWithTwoOrderByClause()
      • testSelectQueryWithAscDescOrderByClause

        public void testSelectQueryWithAscDescOrderByClause()
      • testHiveSelectCharset

        public void testHiveSelectCharset()
      • testHiveTrimWithBoth

        public void testHiveTrimWithBoth()
      • testHiveTrimWithLeading

        public void testHiveTrimWithLeading()
      • testHiveTrimWithTailing

        public void testHiveTrimWithTailing()
      • testUnparseIn1

        public void testUnparseIn1()
        Tests that IN can be un-parsed.

        This cannot be tested using "sql", because because Calcite's SQL parser replaces INs with ORs or sub-queries.

      • testUnparseIn2

        public void testUnparseIn2()
      • testUnparseInStruct1

        public void testUnparseInStruct1()
      • testUnparseInStruct2

        public void testUnparseInStruct2()
      • testSelectQueryWithLimitClause

        public void testSelectQueryWithLimitClause()
      • testPositionFunctionForHive

        public void testPositionFunctionForHive()
      • testPositionFunctionForBigQuery

        public void testPositionFunctionForBigQuery()
      • testCharLiteralForBigQuery

        public void testCharLiteralForBigQuery()
        Tests that we escape single-quotes in character literals using back-slash in BigQuery. The norm is to escape single-quotes with single-quotes.
      • testIdentifier

        public void testIdentifier()
      • testModFunctionForHive

        public void testModFunctionForHive()
      • testUnionOperatorForBigQuery

        public void testUnionOperatorForBigQuery()
      • testIntersectOperatorForBigQuery

        public void testIntersectOperatorForBigQuery()
      • testExceptOperatorForBigQuery

        public void testExceptOperatorForBigQuery()
      • testHiveSelectQueryWithOrderByDescAndNullsFirstShouldBeEmulated

        public void testHiveSelectQueryWithOrderByDescAndNullsFirstShouldBeEmulated()
      • testHiveSelectQueryWithOrderByAscAndNullsLastShouldBeEmulated

        public void testHiveSelectQueryWithOrderByAscAndNullsLastShouldBeEmulated()
      • testHiveSelectQueryWithOrderByAscNullsFirstShouldNotAddNullEmulation

        public void testHiveSelectQueryWithOrderByAscNullsFirstShouldNotAddNullEmulation()
      • testHiveSelectQueryWithOrderByDescNullsLastShouldNotAddNullEmulation

        public void testHiveSelectQueryWithOrderByDescNullsLastShouldNotAddNullEmulation()
      • testMysqlCastToBigint

        public void testMysqlCastToBigint()
      • testMysqlCastToInteger

        public void testMysqlCastToInteger()
      • testHiveSelectQueryWithOrderByDescAndHighNullsWithVersionGreaterThanOrEq21

        public void testHiveSelectQueryWithOrderByDescAndHighNullsWithVersionGreaterThanOrEq21()
      • testHiveSelectQueryWithOrderByDescAndHighNullsWithVersion20

        public void testHiveSelectQueryWithOrderByDescAndHighNullsWithVersion20()
      • testJethroDataSelectQueryWithOrderByDescAndNullsFirstShouldBeEmulated

        public void testJethroDataSelectQueryWithOrderByDescAndNullsFirstShouldBeEmulated()
      • testMySqlSelectQueryWithOrderByDescAndNullsFirstShouldBeEmulated

        public void testMySqlSelectQueryWithOrderByDescAndNullsFirstShouldBeEmulated()
      • testMySqlSelectQueryWithOrderByAscAndNullsLastShouldBeEmulated

        public void testMySqlSelectQueryWithOrderByAscAndNullsLastShouldBeEmulated()
      • testMySqlSelectQueryWithOrderByAscNullsFirstShouldNotAddNullEmulation

        public void testMySqlSelectQueryWithOrderByAscNullsFirstShouldNotAddNullEmulation()
      • testMySqlSelectQueryWithOrderByDescNullsLastShouldNotAddNullEmulation

        public void testMySqlSelectQueryWithOrderByDescNullsLastShouldNotAddNullEmulation()
      • testMySqlWithHighNullsSelectWithOrderByAscNullsLastAndNoEmulation

        public void testMySqlWithHighNullsSelectWithOrderByAscNullsLastAndNoEmulation()
      • testMySqlWithHighNullsSelectWithOrderByAscNullsFirstAndNullEmulation

        public void testMySqlWithHighNullsSelectWithOrderByAscNullsFirstAndNullEmulation()
      • testMySqlWithHighNullsSelectWithOrderByDescNullsFirstAndNoEmulation

        public void testMySqlWithHighNullsSelectWithOrderByDescNullsFirstAndNoEmulation()
      • testMySqlWithHighNullsSelectWithOrderByDescNullsLastAndNullEmulation

        public void testMySqlWithHighNullsSelectWithOrderByDescNullsLastAndNullEmulation()
      • testMySqlWithFirstNullsSelectWithOrderByDescAndNullsFirstShouldNotBeEmulated

        public void testMySqlWithFirstNullsSelectWithOrderByDescAndNullsFirstShouldNotBeEmulated()
      • testMySqlWithFirstNullsSelectWithOrderByAscAndNullsFirstShouldNotBeEmulated

        public void testMySqlWithFirstNullsSelectWithOrderByAscAndNullsFirstShouldNotBeEmulated()
      • testMySqlWithFirstNullsSelectWithOrderByDescAndNullsLastShouldBeEmulated

        public void testMySqlWithFirstNullsSelectWithOrderByDescAndNullsLastShouldBeEmulated()
      • testMySqlWithFirstNullsSelectWithOrderByAscAndNullsLastShouldBeEmulated

        public void testMySqlWithFirstNullsSelectWithOrderByAscAndNullsLastShouldBeEmulated()
      • testMySqlWithLastNullsSelectWithOrderByDescAndNullsFirstShouldBeEmulated

        public void testMySqlWithLastNullsSelectWithOrderByDescAndNullsFirstShouldBeEmulated()
      • testMySqlWithLastNullsSelectWithOrderByAscAndNullsFirstShouldBeEmulated

        public void testMySqlWithLastNullsSelectWithOrderByAscAndNullsFirstShouldBeEmulated()
      • testMySqlWithLastNullsSelectWithOrderByDescAndNullsLastShouldNotBeEmulated

        public void testMySqlWithLastNullsSelectWithOrderByDescAndNullsLastShouldNotBeEmulated()
      • testMySqlWithLastNullsSelectWithOrderByAscAndNullsLastShouldNotBeEmulated

        public void testMySqlWithLastNullsSelectWithOrderByAscAndNullsLastShouldNotBeEmulated()
      • testSelectQueryWithLimitClauseWithoutOrder

        public void testSelectQueryWithLimitClauseWithoutOrder()
      • testSelectQueryWithLimitOffsetClause

        public void testSelectQueryWithLimitOffsetClause()
      • testSelectQueryWithParameters

        public void testSelectQueryWithParameters()
      • testSelectQueryWithFetchOffsetClause

        public void testSelectQueryWithFetchOffsetClause()
      • testSelectQueryComplex

        public void testSelectQueryComplex()
      • testSelectQueryWithGroup

        public void testSelectQueryWithGroup()
      • testSimpleJoin

        public void testSimpleJoin()
      • testSimpleJoinUsing

        public void testSimpleJoinUsing()
      • testCartesianProductWithCommaSyntax

        public void testCartesianProductWithCommaSyntax()
      • testCartesianProductWithInnerJoinSyntax

        public void testCartesianProductWithInnerJoinSyntax()
      • testFullJoinOnTrueCondition

        public void testFullJoinOnTrueCondition()
      • testSimpleIn

        public void testSimpleIn()
      • testDb2DialectSelfJoinStar

        public void testDb2DialectSelfJoinStar()
      • testDb2DialectJoin

        public void testDb2DialectJoin()
      • testDb2DialectSelfJoin

        public void testDb2DialectSelfJoin()
      • testDb2DialectWhere

        public void testDb2DialectWhere()
      • testDb2DialectJoinWhere

        public void testDb2DialectJoinWhere()
      • testDb2DialectSelfJoinWhere

        public void testDb2DialectSelfJoinWhere()
      • testDb2DialectCast

        public void testDb2DialectCast()
      • testDb2DialectSelectQueryWithGroupByHaving

        public void testDb2DialectSelectQueryWithGroupByHaving()
      • testDb2DialectSelectQueryComplex

        public void testDb2DialectSelectQueryComplex()
      • testDb2DialectSelectQueryWithGroup

        public void testDb2DialectSelectQueryWithGroup()
      • testLiteral

        public void testLiteral()
      • checkLiteral

        private void checkLiteral​(java.lang.String expression)
      • checkLiteral2

        private void checkLiteral2​(java.lang.String expression,
                                   java.lang.String expected)
      • testRankFunctionForPrintingOfFrameBoundary

        public void testRankFunctionForPrintingOfFrameBoundary()
      • testLeadFunctionForPrintingOfFrameBoundary

        public void testLeadFunctionForPrintingOfFrameBoundary()
      • testLagFunctionForPrintingOfFrameBoundary

        public void testLagFunctionForPrintingOfFrameBoundary()
      • testFloorPostgres

        public void testFloorPostgres()
      • testFloorOracle

        public void testFloorOracle()
      • testFloorMssqlWeek

        public void testFloorMssqlWeek()
      • testFloorMssqlMonth

        public void testFloorMssqlMonth()
      • testFloorMysqlMonth

        public void testFloorMysqlMonth()
      • testUnparseSqlIntervalQualifierDb2

        public void testUnparseSqlIntervalQualifierDb2()
      • testUnparseSqlIntervalQualifierMySql

        public void testUnparseSqlIntervalQualifierMySql()
      • testUnparseSqlIntervalQualifierMsSql

        public void testUnparseSqlIntervalQualifierMsSql()
      • testFloorMysqlWeek

        public void testFloorMysqlWeek()
      • testFloorMysqlHour

        public void testFloorMysqlHour()
      • testFloorMysqlMinute

        public void testFloorMysqlMinute()
      • testFloorMysqlSecond

        public void testFloorMysqlSecond()
      • testSubstring

        public void testSubstring()
      • testSubstringWithFor

        public void testSubstringWithFor()
      • testNotExistsWithExpand

        public void testNotExistsWithExpand()
      • testSubQueryInWithExpand

        public void testSubQueryInWithExpand()
      • testSubQueryInWithExpand2

        public void testSubQueryInWithExpand2()
      • testSubQueryNotInWithExpand

        public void testSubQueryNotInWithExpand()
      • testLike

        public void testLike()
      • testNotLike

        public void testNotLike()
      • testMatchRecognizePatternExpression

        public void testMatchRecognizePatternExpression()
      • testMatchRecognizePatternExpression2

        public void testMatchRecognizePatternExpression2()
      • testMatchRecognizePatternExpression3

        public void testMatchRecognizePatternExpression3()
      • testMatchRecognizePatternExpression4

        public void testMatchRecognizePatternExpression4()
      • testMatchRecognizePatternExpression5

        public void testMatchRecognizePatternExpression5()
      • testMatchRecognizePatternExpression6

        public void testMatchRecognizePatternExpression6()
      • testMatchRecognizePatternExpression7

        public void testMatchRecognizePatternExpression7()
      • testMatchRecognizePatternExpression8

        public void testMatchRecognizePatternExpression8()
      • testMatchRecognizePatternExpression9

        public void testMatchRecognizePatternExpression9()
      • testMatchRecognizePatternExpression10

        public void testMatchRecognizePatternExpression10()
      • testMatchRecognizePatternExpression11

        public void testMatchRecognizePatternExpression11()
      • testMatchRecognizePatternExpression12

        public void testMatchRecognizePatternExpression12()
      • testMatchRecognizePatternExpression13

        public void testMatchRecognizePatternExpression13()
      • testMatchRecognizeDefineClause

        public void testMatchRecognizeDefineClause()
      • testMatchRecognizeDefineClause2

        public void testMatchRecognizeDefineClause2()
      • testMatchRecognizeDefineClause3

        public void testMatchRecognizeDefineClause3()
      • testMatchRecognizeDefineClause4

        public void testMatchRecognizeDefineClause4()
      • testMatchRecognizeMeasures1

        public void testMatchRecognizeMeasures1()
      • testMatchRecognizeMeasures2

        public void testMatchRecognizeMeasures2()
      • testMatchRecognizeMeasures3

        public void testMatchRecognizeMeasures3()
      • testMatchRecognizeMeasures4

        public void testMatchRecognizeMeasures4()
      • testMatchRecognizeMeasures5

        public void testMatchRecognizeMeasures5()
      • testMatchRecognizeMeasures6

        public void testMatchRecognizeMeasures6()
      • testMatchRecognizeMeasures7

        public void testMatchRecognizeMeasures7()
      • testMatchRecognizePatternSkip1

        public void testMatchRecognizePatternSkip1()
      • testMatchRecognizePatternSkip2

        public void testMatchRecognizePatternSkip2()
      • testMatchRecognizePatternSkip3

        public void testMatchRecognizePatternSkip3()
      • testMatchRecognizePatternSkip4

        public void testMatchRecognizePatternSkip4()
      • testMatchRecognizePatternSkip5

        public void testMatchRecognizePatternSkip5()
      • testMatchRecognizeSubset1

        public void testMatchRecognizeSubset1()
      • testMatchRecognizeSubset2

        public void testMatchRecognizeSubset2()
      • testMatchRecognizeSubset3

        public void testMatchRecognizeSubset3()
      • testMatchRecognizeSubset4

        public void testMatchRecognizeSubset4()
      • testMatchRecognizeRowsPerMatch1

        public void testMatchRecognizeRowsPerMatch1()
      • testMatchRecognizeRowsPerMatch2

        public void testMatchRecognizeRowsPerMatch2()
      • testMatchRecognizeWithin

        public void testMatchRecognizeWithin()
      • testMatchRecognizeIn

        public void testMatchRecognizeIn()
      • testValues

        public void testValues()
      • testValuesEmpty

        public void testValuesEmpty()
      • testPreservePermutation

        public void testPreservePermutation()
      • testFieldNamesWithAggregateSubQuery

        public void testFieldNamesWithAggregateSubQuery()
      • testUnparseSelectMustUseDialect

        public void testUnparseSelectMustUseDialect()
      • testCorrelate

        public void testCorrelate()
      • testUncollectExplicitAlias

        public void testUncollectExplicitAlias()
      • testUncollectImplicitAlias

        public void testUncollectImplicitAlias()
      • testWithinGroup1

        public void testWithinGroup1()
      • testWithinGroup2

        public void testWithinGroup2()
      • testWithinGroup3

        public void testWithinGroup3()
      • testWithinGroup4

        public void testWithinGroup4()
      • testJsonValueExpressionOperator

        public void testJsonValueExpressionOperator()
      • testJsonExists

        public void testJsonExists()
      • testJsonPretty

        public void testJsonPretty()
      • testJsonValue

        public void testJsonValue()
      • testJsonQuery

        public void testJsonQuery()
      • testJsonArray

        public void testJsonArray()
      • testJsonArrayAgg

        public void testJsonArrayAgg()
      • testJsonObject

        public void testJsonObject()
      • testJsonObjectAgg

        public void testJsonObjectAgg()
      • testJsonPredicate

        public void testJsonPredicate()
      • testCrossJoinEmulationForSpark

        public void testCrossJoinEmulationForSpark()
      • testSubstringInSpark

        public void testSubstringInSpark()
      • testSubstringWithForInSpark

        public void testSubstringWithForInSpark()
      • testFloorInSpark

        public void testFloorInSpark()
      • testNumericFloorInSpark

        public void testNumericFloorInSpark()
      • testJsonStorageSize

        public void testJsonStorageSize()
      • testCubeInSpark

        public void testCubeInSpark()
      • testRollupInSpark

        public void testRollupInSpark()
      • testJsonType

        public void testJsonType()
      • testJsonDepth

        public void testJsonDepth()
      • testJsonLength

        public void testJsonLength()
      • testJsonKeys

        public void testJsonKeys()
      • testJsonRemove

        public void testJsonRemove()
      • testUnionAllWithNoOperandsUsingOracleDialect

        public void testUnionAllWithNoOperandsUsingOracleDialect()
      • testUnionAllWithNoOperands

        public void testUnionAllWithNoOperands()
      • testSmallintOracle

        public void testSmallintOracle()
      • testBigintOracle

        public void testBigintOracle()
      • testDoubleOracle

        public void testDoubleOracle()
      • testDateLiteralOracle

        public void testDateLiteralOracle()
      • testTimestampLiteralOracle

        public void testTimestampLiteralOracle()
      • testTimeLiteralOracle

        public void testTimeLiteralOracle()
      • testSupportsDataType

        public void testSupportsDataType()
      • testSelectNull

        public void testSelectNull()
      • testSelectNullWithCount

        public void testSelectNullWithCount()
      • testSelectNullWithGroupByNull

        public void testSelectNullWithGroupByNull()
      • testSelectNullWithGroupByVar

        public void testSelectNullWithGroupByVar()
      • testSelectNullWithInsert

        public void testSelectNullWithInsert()
      • testSelectNullWithInsertFromJoin

        public void testSelectNullWithInsertFromJoin()
      • testDialectQuoteStringLiteral

        public void testDialectQuoteStringLiteral()