Class GoogleBigQueryDialect
- java.lang.Object
-
- mondrian.spi.impl.JdbcDialectImpl
-
- mondrian.spi.impl.GoogleBigQueryDialect
-
- All Implemented Interfaces:
Dialect
public class GoogleBigQueryDialect extends JdbcDialectImpl
This is the Mondrian dialect for Google BigQuery. It was tested against google-api-services-bigquery-v2-rev355-1.22.0 in Q1 2018.- Author:
- lucboudreau
-
-
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 GoogleBigQueryDialect(Connection connection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallowsAs()Returns whether the SQL dialect allows "AS" in the FROM clause.booleanallowsDdl()Returns whether this dialect supports common SQL Data Definition Language (DDL) statements such asCREATE TABLEandDROP INDEX.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.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.voidquoteIdentifier(String val, StringBuilder buf)Appends to a buffer an identifier, quoted appropriately for this Dialect.voidquoteStringLiteral(StringBuilder buf, String s)Appends to a buffer a single-quoted SQL string.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
allowsCompoundCountDistinct, allowsCountDistinct, allowsCountDistinctWithOtherAggs, allowsDialectSharing, allowsFromQuery, allowsJoinOn, allowsMultipleCountDistinct, allowsMultipleDistinctSqlMeasures, allowsSelectNotInGroupBy, appendHintsAfterFromClause, caseWhenElse, computeStatisticsProviders, deduceIdentifierQuoteString, deduceMaxColumnNameLength, deduceProductName, deduceProductVersion, deduceReadOnly, deduceSupportedResultSetStyles, deduceSupportsSelectNotInGroupBy, extractEmbeddedFlags, generateCountExpression, generateInlineForAnsi, generateInlineGeneric, generateOrderByNulls, generateOrderByNullsAnsi, generateOrderItem, getDatabaseProduct, getMaxColumnNameLength, getProduct, getQuoteIdentifierString, getStatisticsProviders, getType, isDatabase, needsExponent, quote, quoteBooleanLiteral, quoteDateLiteral, quoteDateLiteral, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteNumericLiteral, quoteTimeLiteral, quoteTimestampLiteral, quoteTimestampLiteral, requiresAliasForFromQuery, requiresGroupByAlias, requiresHavingAlias, requiresOrderByAlias, requiresUnionOrderByExprToBeInSelectClause, requiresUnionOrderByOrdinal, supportsGroupByExpressions, supportsGroupingSets, supportsMultiValueInExpr, supportsUnlimitedValueList, toString, toUpper
-
-
-
-
Field Detail
-
FACTORY
public static final JdbcDialectFactory FACTORY
-
-
Constructor Detail
-
GoogleBigQueryDialect
public GoogleBigQueryDialect(Connection connection) throws SQLException
- Throws:
SQLException
-
-
Method Detail
-
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.
-
allowsAs
public boolean allowsAs()
Description copied from interface:DialectReturns whether the SQL dialect allows "AS" in the FROM clause. If so, "SELECT * FROM t AS alias" is a valid query.- Specified by:
allowsAsin interfaceDialect- Overrides:
allowsAsin classJdbcDialectImpl- Returns:
- whether dialect allows AS in FROM clause
-
allowsDdl
public boolean allowsDdl()
Description copied from interface:DialectReturns whether this dialect supports common SQL Data Definition Language (DDL) statements such asCREATE TABLEandDROP INDEX.Access seems to allow DDL iff the .mdb file is writeable.
- Specified by:
allowsDdlin interfaceDialect- Overrides:
allowsDdlin classJdbcDialectImpl- Returns:
- whether this Dialect supports DDL
- See Also:
DatabaseMetaData.isReadOnly()
-
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
-
quoteIdentifier
public void quoteIdentifier(String val, StringBuilder buf)
Description copied from interface:DialectAppends to a buffer an identifier, quoted appropriately for this Dialect.- Specified by:
quoteIdentifierin interfaceDialect- Overrides:
quoteIdentifierin classJdbcDialectImpl- Parameters:
val- identifier to quote (must not be null).buf- Buffer
-
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
-
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.
-
-