Class StarRocksSqlDialect


public class StarRocksSqlDialect extends MysqlSqlDialect
A SqlDialect implementation for the StarRocks database.
  • Field Details

  • Constructor Details

    • StarRocksSqlDialect

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

    • supportsGroupByWithRollup

      public boolean supportsGroupByWithRollup()
      Description copied from class: SqlDialect
      Returns whether this dialect supports "WITH ROLLUP" in the "GROUP BY" clause.

      For instance, in MySQL version 5,

      SELECT deptno, job, COUNT(*) AS c FROM emp GROUP BY deptno, job WITH ROLLUP

      is equivalent to standard SQL

      SELECT deptno, job, COUNT(*) AS c FROM emp GROUP BY ROLLUP(deptno, job) ORDER BY deptno, job

      The "WITH ROLLUP" clause was introduced in MySQL and is not standard SQL.

      See also SqlDialect.supportsAggregateFunction(SqlKind) applied to SqlKind.ROLLUP, which returns true in MySQL 8 and higher.

      Overrides:
      supportsGroupByWithRollup in class MysqlSqlDialect
    • supportsTimestampPrecision

      public boolean supportsTimestampPrecision()
      Description copied from class: SqlDialect
      Returns whether this dialect supports TIMESTAMP with precision.
      Overrides:
      supportsTimestampPrecision in class SqlDialect
    • supportsApproxCountDistinct

      public boolean supportsApproxCountDistinct()
      Description copied from class: SqlDialect
      Returns whether this dialect supports APPROX_COUNT_DISTINCT functions.
      Overrides:
      supportsApproxCountDistinct in class SqlDialect
    • unparseCall

      public void unparseCall(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec)
      Overrides:
      unparseCall in class MysqlSqlDialect
    • 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 MysqlSqlDialect
    • unparseDateTimeLiteral

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