Class RedshiftDialect

All Implemented Interfaces:
Dialect

public class RedshiftDialect extends PostgreSqlDialect
User: cboyden Date: 2/8/13
  • Field Details

  • Constructor Details

  • Method Details

    • getDatabaseProduct

      public Dialect.DatabaseProduct getDatabaseProduct()
      Description copied from interface: Dialect
      Returns the database for this Dialect, or Dialect.DatabaseProduct.UNKNOWN if the database is not a common database.
      Specified by:
      getDatabaseProduct in interface Dialect
      Overrides:
      getDatabaseProduct in class PostgreSqlDialect
      Returns:
      Database
    • generateInline

      public String generateInline(List<String> columnNames, List<String> columnTypes, List<String[]> valueList)
      Description copied from interface: Dialect
      Generates a SQL statement to represent an inline dataset.

      For example, for Oracle, generates

       SELECT 1 AS FOO, 'a' AS BAR FROM dual
       UNION ALL
       SELECT 2 AS FOO, 'b' AS BAR FROM dual
       

      For ANSI SQL, generates:

       VALUES (1, 'a'), (2, 'b')
       
      Specified by:
      generateInline in interface Dialect
      Overrides:
      generateInline in class JdbcDialectImpl
      Parameters:
      columnNames - List of column names
      columnTypes - List of column types ("String" or "Numeric")
      valueList - List of rows values
      Returns:
      SQL string
    • quoteStringLiteral

      public void quoteStringLiteral(StringBuilder buf, String value)
      Description copied from interface: Dialect
      Appends to a buffer a single-quoted SQL string.

      For example, in the default dialect, quoteStringLiteral(buf, "Can't") appends "'Can''t'" to buf.

      Specified by:
      quoteStringLiteral in interface Dialect
      Overrides:
      quoteStringLiteral in class JdbcDialectImpl
      Parameters:
      buf - Buffer to append to
      value - Literal
    • allowsRegularExpressionInWhereClause

      public boolean allowsRegularExpressionInWhereClause()
      Description copied from interface: Dialect
      Informs Mondrian if the dialect supports regular expressions when creating the 'where' or the 'having' clause.
      Specified by:
      allowsRegularExpressionInWhereClause in interface Dialect
      Overrides:
      allowsRegularExpressionInWhereClause in class PostgreSqlDialect
      Returns:
      True if regular expressions are supported.
    • generateRegularExpression

      public String generateRegularExpression(String source, String javaRegex)
      Description copied from interface: Dialect
      Must generate a String representing a regular expression match operation between a string literal and a Java regular expression. The string literal might be a column identifier or some other identifier, but the implementation must presume that it is already escaped and fit for use. The regular expression is not escaped and must be adapted to the proper dialect rules.

      Postgres / Greenplum example:

      generateRegularExpression( "'foodmart'.'customer_name'", "(?i).*oo.*") -> 'foodmart'.'customer_name' ~ "(?i).*oo.*"

      Oracle example:

      generateRegularExpression( "'foodmart'.'customer_name'", ".*oo.*") -> REGEXP_LIKE('foodmart'.'customer_name', ".*oo.*")

      Dialects are allowed to return null if the dialect cannot convert that particular regular expression into something that the database would support.

      Specified by:
      generateRegularExpression in interface Dialect
      Overrides:
      generateRegularExpression in class PostgreSqlDialect
      Parameters:
      source - A String identifying the column to match against.
      javaRegex - A Java regular expression to match against.
      Returns:
      A dialect specific matching operation, or null if the dialect cannot convert that particular regular expression into something that the database would support.