Class SAPHanaSqlDialect


  • public class SAPHanaSqlDialect
    extends org.apache.calcite.sql.dialect.PostgresqlSqlDialect
    Calcite SQL dialect for SAP HANA (Calcite 1.40.0). Behavior: - Unquoted identifiers are folded to UPPERCASE - Quoted identifiers preserve case - BOOLEAN MAX/MIN rewritten to BOOL aggregations - OFFSET/FETCH rendered as LIMIT/OFFSET
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.calcite.sql.SqlDialect

        org.apache.calcite.sql.SqlDialect.CalendarPolicy, org.apache.calcite.sql.SqlDialect.Context, org.apache.calcite.sql.SqlDialect.DatabaseProduct, org.apache.calcite.sql.SqlDialect.FakeUtil
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static SAPHanaSqlDialect DEFAULT  
      static org.apache.calcite.sql.SqlDialect.Context DEFAULT_CONTEXT  
      • Fields inherited from class org.apache.calcite.sql.dialect.PostgresqlSqlDialect

        POSTGRESQL_TYPE_SYSTEM
      • Fields inherited from class org.apache.calcite.sql.SqlDialect

        BUILT_IN_OPERATORS_LIST, EMPTY_CONTEXT, identifierEndQuoteString, identifierEscapedQuote, identifierQuoteString, literalEndQuoteString, literalEscapedQuote, literalQuoteString, LOGGER, nullCollation
    • Constructor Summary

      Constructors 
      Constructor Description
      SAPHanaSqlDialect​(org.apache.calcite.sql.SqlDialect.Context context, boolean upperCaseFilterApplied)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      StringBuilder quoteIdentifier​(StringBuilder buf, String identifier)  
      org.apache.calcite.sql.SqlNode rewriteMaxMinExpr​(org.apache.calcite.sql.SqlNode aggCall, org.apache.calcite.rel.type.RelDataType relDataType)
      Rewrite MAX/MIN(boolean) since SAP HANA does not support MAX/MIN on BOOLEAN types.
      boolean supportsApproxCountDistinct()  
      void unparseCall​(org.apache.calcite.sql.SqlWriter writer, org.apache.calcite.sql.SqlCall call, int leftPrec, int rightPrec)  
      void unparseOffsetFetch​(org.apache.calcite.sql.SqlWriter writer, @Nullable org.apache.calcite.sql.SqlNode offset, @Nullable org.apache.calcite.sql.SqlNode fetch)  
      • Methods inherited from class org.apache.calcite.sql.dialect.PostgresqlSqlDialect

        getCastSpec, requiresAliasForFromItems, rewriteSingleValueExpr, supportsCharSet, supportsFunction, supportsGroupByLiteral, supportsImplicitTypeCoercion, supportsNestedAggregations, unparseSqlSetOption
      • Methods inherited from class org.apache.calcite.sql.SqlDialect

        allowsAs, configureParser, configureParser, containsNonAscii, create, defaultNullDirection, emulateJoinTypeForCrossJoin, emulateNullDirection, emulateNullDirectionWithIsNull, getCalendarPolicy, getConformance, getDatabaseProduct, getFormatModel, getNullCollation, getProduct, getQuotedCasing, getQuoting, getSingleRowTableName, getTypeSystem, getUnquotedCasing, hasImplicitTableAlias, identifierNeedsQuote, isCaseSensitive, prepareUnparse, quoteIdentifier, quoteIdentifier, quoteStringLiteral, quoteStringLiteral, quoteStringLiteralUnicode, quoteTimestampLiteral, rewriteMaxMin, supportBooleanCaseWhen, supportsAggregateFunction, supportsAggregateFunctionFilter, supportsAliasedValues, supportsDataType, supportsGroupByWithCube, supportsGroupByWithRollup, supportsJoinType, supportsOffsetFetch, supportsTimestampPrecision, supportsWindowFunctions, unparseBoolLiteral, unparseDateTimeLiteral, unparseFetchUsingAnsi, unparseFetchUsingLimit, unparseLimit, unparseNumericLiteral, unparseOffset, unparseSqlDatetimeArithmetic, unparseSqlIntervalLiteral, unparseSqlIntervalQualifier, unparseTableScanHints, unparseTopN, unquoteStringLiteral
    • Field Detail

      • DEFAULT_CONTEXT

        public static final org.apache.calcite.sql.SqlDialect.Context DEFAULT_CONTEXT
    • Constructor Detail

      • SAPHanaSqlDialect

        public SAPHanaSqlDialect​(org.apache.calcite.sql.SqlDialect.Context context,
                                 boolean upperCaseFilterApplied)
    • Method Detail

      • unparseCall

        public void unparseCall​(org.apache.calcite.sql.SqlWriter writer,
                                org.apache.calcite.sql.SqlCall call,
                                int leftPrec,
                                int rightPrec)
        Overrides:
        unparseCall in class org.apache.calcite.sql.dialect.PostgresqlSqlDialect
      • rewriteMaxMinExpr

        public org.apache.calcite.sql.SqlNode rewriteMaxMinExpr​(org.apache.calcite.sql.SqlNode aggCall,
                                                                org.apache.calcite.rel.type.RelDataType relDataType)
        Rewrite MAX/MIN(boolean) since SAP HANA does not support MAX/MIN on BOOLEAN types. MAX(boolean) -> BOOLOR_AGG MIN(boolean) -> BOOLAND_AGG
        Overrides:
        rewriteMaxMinExpr in class org.apache.calcite.sql.dialect.PostgresqlSqlDialect
      • unparseOffsetFetch

        public void unparseOffsetFetch​(org.apache.calcite.sql.SqlWriter writer,
                                       @Nullable org.apache.calcite.sql.SqlNode offset,
                                       @Nullable org.apache.calcite.sql.SqlNode fetch)
        Overrides:
        unparseOffsetFetch in class org.apache.calcite.sql.SqlDialect
      • supportsApproxCountDistinct

        public boolean supportsApproxCountDistinct()
        Overrides:
        supportsApproxCountDistinct in class org.apache.calcite.sql.SqlDialect
      • quoteIdentifier

        public StringBuilder quoteIdentifier​(StringBuilder buf,
                                             String identifier)
        Overrides:
        quoteIdentifier in class org.apache.calcite.sql.SqlDialect