Package org.apache.calcite.sql.dialect
Class HiveSqlDialect
- java.lang.Object
-
- org.apache.calcite.sql.SqlDialect
-
- org.apache.calcite.sql.dialect.HiveSqlDialect
-
public class HiveSqlDialect extends SqlDialect
ASqlDialect
implementation for the Apache Hive database.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.calcite.sql.SqlDialect
SqlDialect.CalendarPolicy, SqlDialect.Context, SqlDialect.DatabaseProduct, SqlDialect.FakeUtil
-
-
Field Summary
Fields Modifier and Type Field Description static SqlDialect
DEFAULT
private boolean
emulateNullDirection
-
Fields inherited from class org.apache.calcite.sql.SqlDialect
BUILT_IN_OPERATORS_LIST, CALCITE, DUMMY, EMPTY_CONTEXT, LOGGER, nullCollation
-
-
Constructor Summary
Constructors Constructor Description HiveSqlDialect(SqlDialect.Context context)
Creates a HiveSqlDialect.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
allowsAs()
SqlNode
emulateNullDirection(SqlNode node, boolean nullsFirst, boolean desc)
Returns the SqlNode for emulating the null direction for the given field ornull
if no emulation needs to be done.boolean
supportsCharSet()
Returns whether the dialect supports character set names as part of a data type, for instanceVARCHAR(30) CHARACTER SET `ISO-8859-1`
.void
unparseOffsetFetch(SqlWriter writer, SqlNode offset, SqlNode fetch)
Converts an offset and fetch into SQL.-
Methods inherited from class org.apache.calcite.sql.SqlDialect
create, defaultNullDirection, emptyContext, emulateNullDirectionWithIsNull, getCalendarPolicy, getCastSpec, getDatabaseProduct, getNullCollation, getProduct, getTypeSystem, hasImplicitTableAlias, identifierNeedsToBeQuoted, quoteIdentifier, quoteIdentifier, quoteIdentifier, quoteStringLiteral, quoteStringLiteralUnicode, quoteTimestampLiteral, requiresAliasForFromItems, rewriteSingleValueExpr, supportsAggregateFunction, supportsAliasedValues, supportsFunction, supportsNestedAggregations, supportsOffsetFetch, supportsWindowFunctions, unparseCall, unparseDateTimeLiteral, unparseFetchUsingAnsi, unparseFetchUsingLimit, unparseSqlDatetimeArithmetic, unparseSqlIntervalLiteral, unparseSqlIntervalQualifier, unquoteStringLiteral
-
-
-
-
Field Detail
-
DEFAULT
public static final SqlDialect DEFAULT
-
emulateNullDirection
private final boolean emulateNullDirection
-
-
Constructor Detail
-
HiveSqlDialect
public HiveSqlDialect(SqlDialect.Context context)
Creates a HiveSqlDialect.
-
-
Method Detail
-
allowsAs
protected boolean allowsAs()
- Overrides:
allowsAs
in classSqlDialect
-
unparseOffsetFetch
public void unparseOffsetFetch(SqlWriter writer, SqlNode offset, SqlNode fetch)
Description copied from class:SqlDialect
Converts an offset and fetch into SQL.At least one of
offset
andfetch
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)
- Overrides:
unparseOffsetFetch
in classSqlDialect
- Parameters:
writer
- Writeroffset
- Number of rows to skip before emitting, or nullfetch
- Number of rows to fetch, or null- See Also:
SqlDialect.unparseFetchUsingAnsi(SqlWriter, SqlNode, SqlNode)
,SqlDialect.unparseFetchUsingLimit(SqlWriter, SqlNode, SqlNode)
-
emulateNullDirection
public SqlNode emulateNullDirection(SqlNode node, boolean nullsFirst, boolean desc)
Description copied from class:SqlDialect
Returns the SqlNode for emulating the null direction for the given field ornull
if no emulation needs to be done.- Overrides:
emulateNullDirection
in classSqlDialect
- Parameters:
node
- The SqlNode representing the expressionnullsFirst
- Whether nulls should come firstdesc
- Whether the sort direction isRelFieldCollation.Direction.DESCENDING
orRelFieldCollation.Direction.STRICTLY_DESCENDING
- Returns:
- A SqlNode for null direction emulation or
null
if not required
-
supportsCharSet
public boolean supportsCharSet()
Description copied from class:SqlDialect
Returns whether the dialect supports character set names as part of a data type, for instanceVARCHAR(30) CHARACTER SET `ISO-8859-1`
.- Overrides:
supportsCharSet
in classSqlDialect
-
-