Class VerticaDialect
- java.lang.Object
-
- mondrian.spi.impl.JdbcDialectImpl
-
- mondrian.spi.impl.VerticaDialect
-
- All Implemented Interfaces:
Dialect
public class VerticaDialect extends JdbcDialectImpl
Implementation ofDialectfor the Vertica database.- Since:
- Sept 11, 2009
- Author:
- Pedro Alves
-
-
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 VerticaDialect(Connection connection)Creates a VerticaDialect.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallowsCountDistinctWithOtherAggs()Returns whether this Dialect supports distinct aggregations with other aggregations in the same query.booleanallowsFromQuery()Returns whether this Dialect allows a subquery in the from clause, for exampleSELECT * FROM (SELECT * FROM t) AS xbooleanallowsMultipleCountDistinct()Returns whether this Dialect supports more than one distinct aggregation in the same query.booleanallowsRegularExpressionInWhereClause()Informs Mondrian if the dialect supports regular expressions when creating the 'where' or the 'having' 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.Dialect.DatabaseProductgetDatabaseProduct()Returns the database for this Dialect, orDialect.DatabaseProduct.UNKNOWNif the database is not a common database.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.booleanrequiresAliasForFromQuery()Returns whether this Dialect requires subqueries in the FROM clause to have an alias.booleansupportsMultiValueInExpr()Returns true if this dialect supports multi-value IN expressions.booleansupportsResultSetConcurrency(int type, int concurrency)Returns whether this Dialect supports the given concurrency type in combination with the given result set type.-
Methods inherited from class mondrian.spi.impl.JdbcDialectImpl
allowsAs, allowsCompoundCountDistinct, allowsCountDistinct, allowsDdl, allowsDialectSharing, allowsJoinOn, allowsMultipleDistinctSqlMeasures, allowsOrderByAlias, allowsSelectNotInGroupBy, appendHintsAfterFromClause, caseWhenElse, computeStatisticsProviders, deduceIdentifierQuoteString, deduceMaxColumnNameLength, deduceProductName, deduceProductVersion, deduceReadOnly, deduceSupportedResultSetStyles, deduceSupportsSelectNotInGroupBy, extractEmbeddedFlags, generateCountExpression, generateInlineForAnsi, generateInlineGeneric, generateOrderByNulls, generateOrderByNullsAnsi, generateOrderItem, getMaxColumnNameLength, getProduct, getQuoteIdentifierString, getStatisticsProviders, isDatabase, needsExponent, quote, quoteBooleanLiteral, quoteDateLiteral, quoteDateLiteral, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteNumericLiteral, quoteStringLiteral, quoteTimeLiteral, quoteTimestampLiteral, quoteTimestampLiteral, requiresGroupByAlias, requiresHavingAlias, requiresOrderByAlias, requiresUnionOrderByExprToBeInSelectClause, requiresUnionOrderByOrdinal, supportsGroupByExpressions, supportsGroupingSets, supportsUnlimitedValueList, toString, toUpper
-
-
-
-
Field Detail
-
FACTORY
public static final JdbcDialectFactory FACTORY
-
-
Constructor Detail
-
VerticaDialect
public VerticaDialect(Connection connection) throws SQLException
Creates a VerticaDialect.- Parameters:
connection- Connection- Throws:
SQLException
-
-
Method Detail
-
requiresAliasForFromQuery
public boolean requiresAliasForFromQuery()
Description copied from interface:DialectReturns whether this Dialect requires subqueries in the FROM clause to have an alias.- Specified by:
requiresAliasForFromQueryin interfaceDialect- Overrides:
requiresAliasForFromQueryin classJdbcDialectImpl- Returns:
- whether dialewct requires subqueries to have an alias
- See Also:
Dialect.allowsFromQuery()
-
allowsFromQuery
public boolean allowsFromQuery()
Description copied from interface:DialectReturns whether this Dialect allows a subquery in the from clause, for exampleSELECT * FROM (SELECT * FROM t) AS x- Specified by:
allowsFromQueryin interfaceDialect- Overrides:
allowsFromQueryin classJdbcDialectImpl- Returns:
- whether Dialect allows subquery in FROM clause
- See Also:
Dialect.requiresAliasForFromQuery()
-
getDatabaseProduct
public Dialect.DatabaseProduct getDatabaseProduct()
Description copied from interface:DialectReturns the database for this Dialect, orDialect.DatabaseProduct.UNKNOWNif the database is not a common database.- Specified by:
getDatabaseProductin interfaceDialect- Overrides:
getDatabaseProductin classJdbcDialectImpl- Returns:
- Database
-
allowsMultipleCountDistinct
public boolean allowsMultipleCountDistinct()
Description copied from interface:DialectReturns whether this Dialect supports more than one distinct aggregation in the same query.In Derby 10.1,
is OK, butselect couunt(distinct x) from t
gives "Multiple DISTINCT aggregates are not supported at this time."select couunt(distinct x), count(distinct y) from t- Specified by:
allowsMultipleCountDistinctin interfaceDialect- Overrides:
allowsMultipleCountDistinctin classJdbcDialectImpl- Returns:
- whether this Dialect supports more than one distinct aggregation in the same query
-
allowsCountDistinctWithOtherAggs
public boolean allowsCountDistinctWithOtherAggs()
Description copied from interface:DialectReturns whether this Dialect supports distinct aggregations with other aggregations in the same query. This may be enabled for performance reasons (Vertica)- Specified by:
allowsCountDistinctWithOtherAggsin interfaceDialect- Overrides:
allowsCountDistinctWithOtherAggsin classJdbcDialectImpl- Returns:
- whether this Dialect supports more than one distinct aggregation in the same query
-
supportsResultSetConcurrency
public boolean supportsResultSetConcurrency(int type, int concurrency)Description copied from interface:DialectReturns whether this Dialect supports the given concurrency type in combination with the given result set type.The result is similar to
DatabaseMetaData.supportsResultSetConcurrency(int, int), except that the JdbcOdbc bridge in JDK 1.6 overstates its abilities. See bug 1690406.- Specified by:
supportsResultSetConcurrencyin interfaceDialect- Overrides:
supportsResultSetConcurrencyin classJdbcDialectImpl- Parameters:
type- defined inResultSetconcurrency- type defined inResultSet- Returns:
trueif so;falseotherwise
-
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
-
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
-
supportsMultiValueInExpr
public boolean supportsMultiValueInExpr()
Description copied from interface:DialectReturns true if this dialect supports multi-value IN expressions. E.g.,WHERE (col1, col2) IN ((val1a, val2a), (val1b, val2b))- Specified by:
supportsMultiValueInExprin interfaceDialect- Overrides:
supportsMultiValueInExprin classJdbcDialectImpl- Returns:
- true if the dialect supports multi-value IN expressions
-
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.
-
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.
-
-