public class SparkSqlDialect extends SqlDialect
SqlDialect
implementation for the APACHE SPARK database.SqlDialect.CalendarPolicy, SqlDialect.Context, SqlDialect.DatabaseProduct, SqlDialect.FakeUtil
Modifier and Type | Field and Description |
---|---|
static SqlDialect |
DEFAULT |
private static SqlFunction |
SPARKSQL_SUBSTRING |
BUILT_IN_OPERATORS_LIST, CALCITE, DUMMY, EMPTY_CONTEXT, LOGGER, nullCollation
Constructor and Description |
---|
SparkSqlDialect(SqlDialect.Context context)
Creates a SparkSqlDialect.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
allowsAs() |
JoinType |
emulateJoinTypeForCrossJoin() |
boolean |
supportsCharSet()
Returns whether the dialect supports character set names as part of a
data type, for instance
VARCHAR(30) CHARACTER SET `ISO-8859-1` . |
boolean |
supportsGroupByWithCube()
Returns whether this dialect supports "WITH CUBE" in "GROUP BY" clause.
|
boolean |
supportsGroupByWithRollup()
Returns whether this dialect supports "WITH ROLLUP" in the "GROUP BY"
clause.
|
void |
unparseCall(SqlWriter writer,
SqlCall call,
int leftPrec,
int rightPrec) |
void |
unparseOffsetFetch(SqlWriter writer,
SqlNode offset,
SqlNode fetch)
Converts an offset and fetch into SQL.
|
configureParser, create, defaultNullDirection, emptyContext, emulateNullDirection, emulateNullDirectionWithIsNull, getCalendarPolicy, getCastSpec, getConformance, getDatabaseProduct, getNullCollation, getProduct, getQuotedCasing, getQuoting, getTypeSystem, getUnquotedCasing, hasImplicitTableAlias, isCaseSensitive, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteStringLiteral, quoteStringLiteralUnicode, quoteTimestampLiteral, requiresAliasForFromItems, rewriteSingleValueExpr, supportsAggregateFunction, supportsAliasedValues, supportsFunction, supportsNestedAggregations, supportsOffsetFetch, supportsWindowFunctions, unparseDateTimeLiteral, unparseFetchUsingAnsi, unparseFetchUsingLimit, unparseSqlDatetimeArithmetic, unparseSqlIntervalLiteral, unparseSqlIntervalQualifier, unquoteStringLiteral
public static final SqlDialect DEFAULT
private static final SqlFunction SPARKSQL_SUBSTRING
public SparkSqlDialect(SqlDialect.Context context)
protected boolean allowsAs()
allowsAs
in class SqlDialect
public boolean supportsCharSet()
SqlDialect
VARCHAR(30) CHARACTER SET `ISO-8859-1`
.supportsCharSet
in class SqlDialect
public JoinType emulateJoinTypeForCrossJoin()
emulateJoinTypeForCrossJoin
in class SqlDialect
public boolean supportsGroupByWithRollup()
SqlDialect
For instance, in MySQL version 5,
SELECT deptno, job, COUNT(*) AS c
FROM emp
GROUP BY deptno, job WITH ROLLUP
is equivalent to standard SQL
SELECT deptno, job, COUNT(*) AS c
FROM emp
GROUP BY ROLLUP(deptno, job)
ORDER BY deptno, job
The "WITH ROLLUP" clause was introduced in MySQL and is not standard SQL.
See also SqlDialect.supportsAggregateFunction(SqlKind)
applied to
SqlKind.ROLLUP
, which returns true in MySQL 8 and higher.
supportsGroupByWithRollup
in class SqlDialect
public boolean supportsGroupByWithCube()
SqlDialect
supportsGroupByWithCube
in class SqlDialect
public void unparseOffsetFetch(SqlWriter writer, SqlNode offset, SqlNode fetch)
SqlDialect
At least one of offset
and fetch
must be provided.
Common options:
OFFSET offset ROWS FETCH NEXT fetch ROWS ONLY
(ANSI standard SQL, Oracle, PostgreSQL, and the default)
LIMIT fetch OFFSET offset
(Apache Hive, MySQL, Redshift)
unparseOffsetFetch
in class SqlDialect
writer
- Writeroffset
- Number of rows to skip before emitting, or nullfetch
- Number of rows to fetch, or nullSqlDialect.unparseFetchUsingAnsi(SqlWriter, SqlNode, SqlNode)
,
SqlDialect.unparseFetchUsingLimit(SqlWriter, SqlNode, SqlNode)
public void unparseCall(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec)
unparseCall
in class SqlDialect
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.