|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmondrian.spi.impl.JdbcDialectImpl
mondrian.spi.impl.HiveDialect
public class HiveDialect
Implementation of Dialect for the Hive database.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface mondrian.spi.Dialect |
|---|
Dialect.DatabaseProduct, Dialect.Datatype |
| Field Summary | |
|---|---|
static JdbcDialectFactory |
FACTORY
|
| Fields inherited from class mondrian.spi.impl.JdbcDialectImpl |
|---|
databaseProduct, permitsSelectNotInGroupBy, productVersion |
| Constructor Summary | |
|---|---|
HiveDialect(Connection connection)
Creates a HiveDialect. |
|
| Method Summary | |
|---|---|
boolean |
allowsAs()
Returns whether the SQL dialect allows "AS" in the FROM clause. |
boolean |
allowsCompoundCountDistinct()
Returns whether this Dialect allows multiple arguments to the COUNT(DISTINCT ...) aggregate function, for example
|
boolean |
allowsJoinOn()
Returns whether this dialect supports "ANSI-style JOIN syntax", FROM leftTable JOIN rightTable ON conditon. |
protected String |
deduceIdentifierQuoteString(DatabaseMetaData databaseMetaData)
|
protected int |
deduceMaxColumnNameLength(DatabaseMetaData databaseMetaData)
|
protected boolean |
deduceReadOnly(DatabaseMetaData databaseMetaData)
|
protected Set<List<Integer>> |
deduceSupportedResultSetStyles(DatabaseMetaData databaseMetaData)
|
String |
generateInline(List<String> columnNames,
List<String> columnTypes,
List<String[]> valueList)
Generates a SQL statement to represent an inline dataset. |
protected String |
generateOrderByNulls(String expr,
boolean ascending,
boolean collateNullsLast)
Generates SQL to force null values to collate last. |
protected void |
quoteDateLiteral(StringBuilder buf,
String value,
Date date)
Helper method for JdbcDialectImpl.quoteDateLiteral(StringBuilder, String). |
boolean |
requiresAliasForFromQuery()
Returns whether this Dialect requires subqueries in the FROM clause to have an alias. |
boolean |
requiresOrderByAlias()
Returns true if this Dialect can include expressions in the ORDER BY clause only by adding an expression to the SELECT clause and using its alias. |
boolean |
requiresUnionOrderByExprToBeInSelectClause()
Returns true if this dialect allows an expression in the ORDER BY clause of a UNION (or other set operation) query only if it occurs in the SELECT clause. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final JdbcDialectFactory FACTORY
| Constructor Detail |
|---|
public HiveDialect(Connection connection)
throws SQLException
connection - Connection
SQLException - on error| Method Detail |
|---|
protected String deduceIdentifierQuoteString(DatabaseMetaData databaseMetaData)
deduceIdentifierQuoteString in class JdbcDialectImplprotected Set<List<Integer>> deduceSupportedResultSetStyles(DatabaseMetaData databaseMetaData)
deduceSupportedResultSetStyles in class JdbcDialectImplprotected boolean deduceReadOnly(DatabaseMetaData databaseMetaData)
deduceReadOnly in class JdbcDialectImplprotected int deduceMaxColumnNameLength(DatabaseMetaData databaseMetaData)
deduceMaxColumnNameLength in class JdbcDialectImplpublic boolean allowsCompoundCountDistinct()
DialectCOUNT(DISTINCT ...) aggregate function, for example
SELECT COUNT(DISTINCT x, y) FROM t
- Specified by:
allowsCompoundCountDistinct in interface Dialect- Overrides:
allowsCompoundCountDistinct in class JdbcDialectImpl
- Returns:
- whether Dialect allows multiple arguments to COUNT DISTINCT
- See Also:
Dialect.allowsCountDistinct(),
Dialect.allowsMultipleCountDistinct()
public boolean requiresAliasForFromQuery()
Dialect
requiresAliasForFromQuery in interface DialectrequiresAliasForFromQuery in class JdbcDialectImplDialect.allowsFromQuery()public boolean requiresOrderByAlias()
DialectFor example, in such a dialect,
SELECT x FROM t ORDER BY x + y
would be illegal, but
SELECT x, x + y AS z FROM t ORDER BY z
would be legal.
MySQL, DB2 and Ingres are examples of such dialects.
requiresOrderByAlias in interface DialectrequiresOrderByAlias in class JdbcDialectImplpublic boolean requiresUnionOrderByExprToBeInSelectClause()
DialectFor example,
SELECT x, y + z FROM t
is allowed but
UNION ALL
SELECT x, y + z FROM t
ORDER BY y + zSELECT x, y, z FROM t
UNION ALL
SELECT x, y, z FROM t
ORDER BY y + zSELECT x, y, z FROM t ORDER BY y + z
is not.
Access is an example of a dialect with this restriction.
requiresUnionOrderByExprToBeInSelectClause in interface DialectrequiresUnionOrderByExprToBeInSelectClause in class JdbcDialectImpl
public String generateInline(List<String> columnNames,
List<String> columnTypes,
List<String[]> valueList)
DialectFor 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')
generateInline in interface DialectgenerateInline in class JdbcDialectImplcolumnNames - List of column namescolumnTypes - List of column types ("String" or "Numeric")valueList - List of rows values
protected void quoteDateLiteral(StringBuilder buf,
String value,
Date date)
JdbcDialectImplJdbcDialectImpl.quoteDateLiteral(StringBuilder, String).
quoteDateLiteral in class JdbcDialectImplbuf - Buffer to append tovalue - Value as stringdate - Value as date
protected String generateOrderByNulls(String expr,
boolean ascending,
boolean collateNullsLast)
JdbcDialectImplThis default implementation makes use of the ANSI SQL 1999 CASE-WHEN-THEN-ELSE in conjunction with IS NULL syntax. The resulting SQL will look something like this:
CASE WHEN "expr" IS NULL THEN 0 ELSE 1 END
You can override this method for a particular database to use something more efficient, like ISNULL().
ANSI SQL provides the syntax "ASC/DESC NULLS LAST" and
"ASC/DESC NULLS FIRST". If your database supports the ANSI
syntax, implement this method by calling
JdbcDialectImpl.generateOrderByNullsAnsi(java.lang.String, boolean, boolean).
This method is only called from
JdbcDialectImpl.generateOrderItem(String, boolean, boolean, boolean).
Some dialects override that method and therefore never call
this method.
generateOrderByNulls in class JdbcDialectImplexpr - Expression.ascending - Whether ascending.collateNullsLast - Whether nulls should appear first or last.
public boolean allowsAs()
Dialect
allowsAs in interface DialectallowsAs in class JdbcDialectImplpublic boolean allowsJoinOn()
DialectFROM leftTable JOIN rightTable ON conditon.
allowsJoinOn in interface DialectallowsJoinOn in class JdbcDialectImpl
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||