Class ClickHouseSqlDialect

java.lang.Object
org.apache.calcite.sql.SqlDialect
org.apache.calcite.sql.dialect.ClickHouseSqlDialect

public class ClickHouseSqlDialect extends SqlDialect
A SqlDialect implementation for the ClickHouse database.
  • Field Details

  • Constructor Details

    • ClickHouseSqlDialect

      public ClickHouseSqlDialect(SqlDialect.Context context)
      Creates a ClickHouseSqlDialect.
  • Method Details

    • supportsCharSet

      public boolean supportsCharSet()
      Description copied from class: SqlDialect
      Returns whether the dialect supports character set names as part of a data type, for instance VARCHAR(30) CHARACTER SET `ISO-8859-1`.
      Overrides:
      supportsCharSet in class SqlDialect
    • supportsNestedAggregations

      public boolean supportsNestedAggregations()
      Description copied from class: SqlDialect
      Returns whether the dialect supports nested aggregations, for instance SELECT SUM(SUM(1)) .
      Overrides:
      supportsNestedAggregations in class SqlDialect
    • supportsWindowFunctions

      public boolean supportsWindowFunctions()
      Description copied from class: SqlDialect
      Returns whether this dialect supports window functions (OVER clause).
      Overrides:
      supportsWindowFunctions in class SqlDialect
    • supportsAliasedValues

      public boolean supportsAliasedValues()
      Description copied from class: SqlDialect
      Returns whether the dialect supports VALUES in a sub-query with and an "AS t(column, ...)" values to define column names.

      Currently, only Oracle does not. For this, we generate "SELECT v0 AS c0, v1 AS c1 ... UNION ALL ...". We may need to refactor this method when we support VALUES for other dialects.

      Overrides:
      supportsAliasedValues in class SqlDialect
    • getCalendarPolicy

      public SqlDialect.CalendarPolicy getCalendarPolicy()
      Overrides:
      getCalendarPolicy in class SqlDialect
    • getCastSpec

      public @Nullable SqlNode getCastSpec(RelDataType type)
      Description copied from class: SqlDialect
      Returns SqlNode for type in "cast(column as type)", which might be different between databases by type name, precision etc.

      If this method returns null, the cast will be omitted. In the default implementation, this is the case for the NULL type, and therefore CAST(NULL AS <nulltype>) is rendered as NULL.

      Overrides:
      getCastSpec in class SqlDialect
    • unparseDateTimeLiteral

      public void unparseDateTimeLiteral(SqlWriter writer, SqlAbstractDateTimeLiteral literal, int leftPrec, int rightPrec)
      Overrides:
      unparseDateTimeLiteral in class SqlDialect
    • unparseOffsetFetch

      public void unparseOffsetFetch(SqlWriter writer, @Nullable SqlNode offset, @Nullable SqlNode fetch)
      Description copied from class: SqlDialect
      Converts an offset and fetch into SQL.

      At least one of offset and fetch must be provided.

      Common options:

      • OFFSET offset ROWS FETCH NEXT fetch ROWS ONLY (ANSI standard SQL, Oracle, PostgreSQL, and the default)
      • LIMIT fetch OFFSET offset (Apache Hive, MySQL, Redshift)
      Overrides:
      unparseOffsetFetch in class SqlDialect
      Parameters:
      writer - Writer
      offset - Number of rows to skip before emitting, or null
      fetch - Number of rows to fetch, or null
      See Also:
    • unparseCall

      public void unparseCall(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec)
      Overrides:
      unparseCall in class SqlDialect