Package org.apache.calcite.sql
Class SqlCollation
java.lang.Object
org.apache.calcite.sql.SqlCollation
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
JavaCollation
A
SqlCollation
is an object representing a Collate
statement. It is immutable.- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
A <character value expression> consisting of a column reference has the coercibility characteristic Implicit, with collating sequence as defined when the column was created. -
Field Summary
Modifier and TypeFieldDescriptionstatic final SqlCollation
protected final String
static final SqlCollation
protected final Locale
protected final String
protected final SerializableCharset
-
Constructor Summary
ConstructorDescriptionSqlCollation
(String collation, SqlCollation.Coercibility coercibility) Creates a Collation by its name and its coercibility.SqlCollation
(SqlCollation.Coercibility coercibility) Creates a SqlCollation with the default collation name and the given coercibility.SqlCollation
(SqlCollation.Coercibility coercibility, Locale locale, Charset charset, String strength) Creates a Collation by its coercibility, locale, charset and strength. -
Method Summary
Modifier and TypeMethodDescriptionboolean
protected String
generateCollationName
(Charset charset) protected static @Nullable SqlCollation
getCoercibilityDyadic
(SqlCollation col1, SqlCollation col2) static String
getCoercibilityDyadicComparison
(SqlCollation col1, SqlCollation col2) Returns the collating sequence (the collation name) to use for the resulting value of a comparison.static @Nullable SqlCollation
getCoercibilityDyadicOperator
(SqlCollation col1, SqlCollation col2) Returns the collating sequence (the collation name) and the coercibility for the resulting value of a dyadic operator.static SqlCollation
Returns the collating sequence (the collation name) and the coercibility for the resulting value of a dyadic operator.final String
@Nullable Collator
Returns theCollator
to compare values having the current collation, ornull
if no specificCollator
is needed, in which caseString.compareTo(java.lang.String)
will be used.final Locale
int
hashCode()
toString()
void
-
Field Details
-
COERCIBLE
-
IMPLICIT
-
collationName
-
wrappedCharset
-
locale
-
strength
-
-
Constructor Details
-
SqlCollation
Creates a SqlCollation with the default collation name and the given coercibility.- Parameters:
coercibility
- Coercibility
-
SqlCollation
Creates a Collation by its name and its coercibility.- Parameters:
collation
- Collation specificationcoercibility
- Coercibility
-
SqlCollation
public SqlCollation(SqlCollation.Coercibility coercibility, Locale locale, Charset charset, String strength) Creates a Collation by its coercibility, locale, charset and strength.
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
generateCollationName
-
getCoercibilityDyadicOperator
public static @Nullable SqlCollation getCoercibilityDyadicOperator(SqlCollation col1, SqlCollation col2) Returns the collating sequence (the collation name) and the coercibility for the resulting value of a dyadic operator.- Parameters:
col1
- first operand for the dyadic operationcol2
- second operand for the dyadic operation- Returns:
- the resulting collation sequence. The "no collating sequence" result is returned as null.
- See Also:
-
getCoercibilityDyadicOperatorThrows
public static SqlCollation getCoercibilityDyadicOperatorThrows(SqlCollation col1, SqlCollation col2) Returns the collating sequence (the collation name) and the coercibility for the resulting value of a dyadic operator.- Parameters:
col1
- first operand for the dyadic operationcol2
- second operand for the dyadic operation- Returns:
- the resulting collation sequence
- Throws:
CalciteException
- fromCalciteResource.invalidCompare(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
orCalciteResource.differentCollations(java.lang.String, java.lang.String)
if no collating sequence can be deduced- See Also:
-
getCoercibilityDyadicComparison
Returns the collating sequence (the collation name) to use for the resulting value of a comparison.- Parameters:
col1
- first operand for the dyadic operationcol2
- second operand for the dyadic operation- Returns:
- the resulting collation sequence. If no collating
sequence could be deduced throws a
CalciteResource.invalidCompare(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
- See Also:
-
getCoercibilityDyadic
-
toString
-
unparse
-
getCharset
-
getCollationName
-
getCoercibility
-
getLocale
-
getCollator
Returns theCollator
to compare values having the current collation, ornull
if no specificCollator
is needed, in which caseString.compareTo(java.lang.String)
will be used.
-