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 |
static SqlDialect.Context |
DEFAULT_CONTEXT |
BUILT_IN_OPERATORS_LIST, EMPTY_CONTEXT, identifierEndQuoteString, identifierEscapedQuote, identifierQuoteString, literalEndQuoteString, literalEscapedQuote, literalQuoteString, LOGGER, nullCollation| Constructor and Description |
|---|
SparkSqlDialect(SqlDialect.Context context)
Creates a SparkSqlDialect.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
allowsAs() |
JoinType |
emulateJoinTypeForCrossJoin() |
boolean |
supportsApproxCountDistinct()
Returns whether this dialect supports APPROX_COUNT_DISTINCT functions.
|
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.
|
boolean |
supportsNestedAggregations()
Returns whether the dialect supports nested aggregations, for instance
SELECT SUM(SUM(1)) . |
void |
unparseCall(SqlWriter writer,
SqlCall call,
int leftPrec,
int rightPrec) |
void |
unparseOffsetFetch(SqlWriter writer,
@Nullable SqlNode offset,
@Nullable SqlNode fetch)
Converts an offset and fetch into SQL.
|
configureParser, configureParser, containsNonAscii, create, defaultNullDirection, emulateNullDirection, emulateNullDirectionWithIsNull, getCalendarPolicy, getCastSpec, getConformance, getDatabaseProduct, getNullCollation, getProduct, getQuotedCasing, getQuoting, getSingleRowTableName, getTypeSystem, getUnquotedCasing, hasImplicitTableAlias, identifierNeedsQuote, isCaseSensitive, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteStringLiteral, quoteStringLiteral, quoteStringLiteralUnicode, quoteTimestampLiteral, requiresAliasForFromItems, rewriteSingleValueExpr, supportsAggregateFunction, supportsAggregateFunctionFilter, supportsAliasedValues, supportsDataType, supportsFunction, supportsGroupByLiteral, supportsImplicitTypeCoercion, supportsJoinType, supportsOffsetFetch, supportsWindowFunctions, unparseDateTimeLiteral, unparseFetchUsingAnsi, unparseFetchUsingLimit, unparseLimit, unparseOffset, unparseSqlDatetimeArithmetic, unparseSqlIntervalLiteral, unparseSqlIntervalQualifier, unparseTableScanHints, unparseTopN, unquoteStringLiteralpublic static final SqlDialect.Context DEFAULT_CONTEXT
public static final SqlDialect DEFAULT
public SparkSqlDialect(SqlDialect.Context context)
protected boolean allowsAs()
allowsAs in class SqlDialectpublic boolean supportsCharSet()
SqlDialectVARCHAR(30) CHARACTER SET `ISO-8859-1`.supportsCharSet in class SqlDialectpublic JoinType emulateJoinTypeForCrossJoin()
emulateJoinTypeForCrossJoin in class SqlDialectpublic boolean supportsGroupByWithRollup()
SqlDialectFor 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 SqlDialectpublic boolean supportsNestedAggregations()
SqlDialectSELECT SUM(SUM(1)) .supportsNestedAggregations in class SqlDialectpublic boolean supportsApproxCountDistinct()
SqlDialectsupportsApproxCountDistinct in class SqlDialectpublic boolean supportsGroupByWithCube()
SqlDialectsupportsGroupByWithCube in class SqlDialectpublic void unparseOffsetFetch(SqlWriter writer, @Nullable SqlNode offset, @Nullable SqlNode fetch)
SqlDialectAt 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 SqlDialectwriter - 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 SqlDialectCopyright © 2012-2022 Apache Software Foundation. All Rights Reserved.