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 JdbcDialectFactory
FACTORY
-
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 boolean
allowsAs()
Returns whether the SQL dialect allows "AS" in the FROM clause.boolean
allowsDdl()
Returns whether this dialect supports common SQL Data Definition Language (DDL) statements such asCREATE TABLE
andDROP INDEX
.boolean
allowsOrderByAlias()
Returns true if aliases defined in the SELECT clause can be used as expressions in the ORDER BY clause.boolean
allowsRegularExpressionInWhereClause()
Informs Mondrian if the dialect supports regular expressions when creating the 'where' or the 'having' clause.String
generateInline(List<String> columnNames, List<String> columnTypes, List<String[]> valueList)
Generates a SQL statement to represent an inline dataset.String
generateRegularExpression(String source, String javaRegex)
Must generate a String representing a regular expression match operation between a string literal and a Java regular expression.void
quoteIdentifier(String val, StringBuilder buf)
Appends to a buffer an identifier, quoted appropriately for this Dialect.void
quoteStringLiteral(StringBuilder buf, String s)
Appends to a buffer a single-quoted SQL string.boolean
supportsResultSetConcurrency(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:Dialect
Returns true if aliases defined in the SELECT clause can be used as expressions in the ORDER BY clause.For example, in such a dialect,
SELECT x, x + y AS z FROM t ORDER BY z
MySQL, DB2 and Ingres are examples of dialects where this is true; Access is a dialect where this is false.
- Specified by:
allowsOrderByAlias
in interfaceDialect
- Overrides:
allowsOrderByAlias
in 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:Dialect
Returns whether the SQL dialect allows "AS" in the FROM clause. If so, "SELECT * FROM t AS alias" is a valid query.- Specified by:
allowsAs
in interfaceDialect
- Overrides:
allowsAs
in classJdbcDialectImpl
- Returns:
- whether dialect allows AS in FROM clause
-
allowsDdl
public boolean allowsDdl()
Description copied from interface:Dialect
Returns whether this dialect supports common SQL Data Definition Language (DDL) statements such asCREATE TABLE
andDROP INDEX
.Access seems to allow DDL iff the .mdb file is writeable.
- Specified by:
allowsDdl
in interfaceDialect
- Overrides:
allowsDdl
in classJdbcDialectImpl
- Returns:
- whether this Dialect supports DDL
- See Also:
DatabaseMetaData.isReadOnly()
-
supportsResultSetConcurrency
public boolean supportsResultSetConcurrency(int type, int concurrency)
Description copied from interface:Dialect
Returns 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:
supportsResultSetConcurrency
in interfaceDialect
- Overrides:
supportsResultSetConcurrency
in classJdbcDialectImpl
- Parameters:
type
- defined inResultSet
concurrency
- type defined inResultSet
- Returns:
true
if so;false
otherwise
-
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 interfaceDialect
- Overrides:
generateInline
in 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:Dialect
Appends to a buffer an identifier, quoted appropriately for this Dialect.- Specified by:
quoteIdentifier
in interfaceDialect
- Overrides:
quoteIdentifier
in classJdbcDialectImpl
- Parameters:
val
- identifier to quote (must not be null).buf
- Buffer
-
quoteStringLiteral
public void quoteStringLiteral(StringBuilder buf, String s)
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'
" tobuf
.- Specified by:
quoteStringLiteral
in interfaceDialect
- Overrides:
quoteStringLiteral
in classJdbcDialectImpl
- Parameters:
buf
- Buffer to append tos
- 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 interfaceDialect
- Overrides:
allowsRegularExpressionInWhereClause
in classJdbcDialectImpl
- 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 interfaceDialect
- Overrides:
generateRegularExpression
in 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.
-
-