Class SnowflakeDialect
- java.lang.Object
-
- mondrian.spi.impl.JdbcDialectImpl
-
- mondrian.spi.impl.SnowflakeDialect
-
- All Implemented Interfaces:
Dialect
public class SnowflakeDialect extends JdbcDialectImpl
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface mondrian.spi.Dialect
Dialect.DatabaseProduct, Dialect.Datatype
-
-
Field Summary
Fields Modifier and Type Field Description static JdbcDialectFactoryFACTORY-
Fields inherited from class mondrian.spi.impl.JdbcDialectImpl
databaseProduct, permitsSelectNotInGroupBy, productVersion
-
-
Constructor Summary
Constructors Constructor Description SnowflakeDialect(Connection connection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallowsOrderByAlias()Returns true if aliases defined in the SELECT clause can be used as expressions in the ORDER BY clause.booleanallowsRegularExpressionInWhereClause()Informs Mondrian if the dialect supports regular expressions when creating the 'where' or the 'having' clause.booleanallowsSelectNotInGroupBy()Returns whether the database currently permits queries to include in the SELECT clause expressions that are not listed in the GROUP BY clause.StringgenerateInline(List<String> columnNames, List<String> columnTypes, List<String[]> valueList)Generates a SQL statement to represent an inline dataset.StringgenerateRegularExpression(String source, String javaRegex)Must generate a String representing a regular expression match operation between a string literal and a Java regular expression.StringgetQuoteIdentifierString()Returns the character which is used to quote identifiers, or null if quoting is not supported.SqlStatement.TypegetType(ResultSetMetaData metaData, int columnIndex)Chooses the most appropriate type for accessing the values of a column in a result set for a dialect.voidquoteStringLiteral(StringBuilder buf, String s)Appends to a buffer a single-quoted SQL string.-
Methods inherited from class mondrian.spi.impl.JdbcDialectImpl
allowsAs, allowsCompoundCountDistinct, allowsCountDistinct, allowsCountDistinctWithOtherAggs, allowsDdl, allowsDialectSharing, allowsFromQuery, allowsJoinOn, allowsMultipleCountDistinct, allowsMultipleDistinctSqlMeasures, appendHintsAfterFromClause, caseWhenElse, computeStatisticsProviders, deduceIdentifierQuoteString, deduceMaxColumnNameLength, deduceProductName, deduceProductVersion, deduceReadOnly, deduceSupportedResultSetStyles, deduceSupportsSelectNotInGroupBy, extractEmbeddedFlags, generateCountExpression, generateInlineForAnsi, generateInlineGeneric, generateOrderByNulls, generateOrderByNullsAnsi, generateOrderItem, getDatabaseProduct, getMaxColumnNameLength, getProduct, getStatisticsProviders, isDatabase, needsExponent, quote, quoteBooleanLiteral, quoteDateLiteral, quoteDateLiteral, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteNumericLiteral, quoteTimeLiteral, quoteTimestampLiteral, quoteTimestampLiteral, requiresAliasForFromQuery, requiresGroupByAlias, requiresHavingAlias, requiresOrderByAlias, requiresUnionOrderByExprToBeInSelectClause, requiresUnionOrderByOrdinal, supportsGroupByExpressions, supportsGroupingSets, supportsMultiValueInExpr, supportsResultSetConcurrency, supportsUnlimitedValueList, toString, toUpper
-
-
-
-
Field Detail
-
FACTORY
public static final JdbcDialectFactory FACTORY
-
-
Constructor Detail
-
SnowflakeDialect
public SnowflakeDialect(Connection connection) throws SQLException
- Throws:
SQLException
-
-
Method Detail
-
getQuoteIdentifierString
public String getQuoteIdentifierString()
Description copied from interface:DialectReturns the character which is used to quote identifiers, or null if quoting is not supported.- Specified by:
getQuoteIdentifierStringin interfaceDialect- Overrides:
getQuoteIdentifierStringin classJdbcDialectImpl- Returns:
- identifier quote
-
generateInline
public String generateInline(List<String> columnNames, List<String> columnTypes, List<String[]> valueList)
Description copied from interface:DialectGenerates 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:
generateInlinein interfaceDialect- Overrides:
generateInlinein classJdbcDialectImpl- Parameters:
columnNames- List of column namescolumnTypes- List of column types ("String" or "Numeric")valueList- List of rows values- Returns:
- SQL string
-
quoteStringLiteral
public void quoteStringLiteral(StringBuilder buf, String s)
Description copied from interface:DialectAppends to a buffer a single-quoted SQL string.For example, in the default dialect,
quoteStringLiteral(buf, "Can't")appends "'Can''t'" tobuf.- Specified by:
quoteStringLiteralin interfaceDialect- Overrides:
quoteStringLiteralin classJdbcDialectImpl- Parameters:
buf- Buffer to append tos- Literal
-
allowsOrderByAlias
public boolean allowsOrderByAlias()
Description copied from interface:DialectReturns true if aliases defined in the SELECT clause can be used as expressions in the ORDER BY clause.For example, in such a dialect,
would be legal.SELECT x, x + y AS z FROM t ORDER BY zMySQL, DB2 and Ingres are examples of dialects where this is true; Access is a dialect where this is false.
- Specified by:
allowsOrderByAliasin interfaceDialect- Overrides:
allowsOrderByAliasin classJdbcDialectImpl- Returns:
- Whether aliases defined in the SELECT clause can be used as expressions in the ORDER BY clause.
-
allowsSelectNotInGroupBy
public boolean allowsSelectNotInGroupBy()
Description copied from interface:DialectReturns whether the database currently permits queries to include in the SELECT clause expressions that are not listed in the GROUP BY clause. The SQL standard allows this if the database can deduce that the expression is functionally dependent on columns in the GROUP BY clause.For example,
SELECT empno, first_name || ' ' || last_name FROM emps GROUP BY empnois valid becauseempnois the primary key of theempstable, and therefore all columns are dependent on it. For a given value ofempno,first_name || ' ' || last_namehas a unique value.Most databases do not, MySQL is an example of one that does (if the functioality is enabled).
- Specified by:
allowsSelectNotInGroupByin interfaceDialect- Overrides:
allowsSelectNotInGroupByin classJdbcDialectImpl- Returns:
- Whether this Dialect allows SELECT clauses to contain columns that are not in the GROUP BY clause
-
allowsRegularExpressionInWhereClause
public boolean allowsRegularExpressionInWhereClause()
Description copied from interface:DialectInforms Mondrian if the dialect supports regular expressions when creating the 'where' or the 'having' clause.- Specified by:
allowsRegularExpressionInWhereClausein interfaceDialect- Overrides:
allowsRegularExpressionInWhereClausein classJdbcDialectImpl- Returns:
- True if regular expressions are supported.
-
getType
public SqlStatement.Type getType(ResultSetMetaData metaData, int columnIndex) throws SQLException
Description copied from interface:DialectChooses the most appropriate type for accessing the values of a column in a result set for a dialect.
Dialect-specific nuances involving type representation should be encapsulated in implementing methods. For example, if a dialect has implicit rules involving scale or precision, they should be handled within this method so the client can simply retrieve the "best fit" SqlStatement.Type for the column.
- Specified by:
getTypein interfaceDialect- Overrides:
getTypein classJdbcDialectImpl- Parameters:
metaData- Results set metadatacolumnIndex- Column ordinal (0-based)- Returns:
- the most appropriate SqlStatement.Type for the column
- Throws:
SQLException
-
generateRegularExpression
public String generateRegularExpression(String source, String javaRegex)
Description copied from interface:DialectMust 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:
generateRegularExpressionin interfaceDialect- Overrides:
generateRegularExpressionin classJdbcDialectImpl- 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.
-
-