public class Calcites extends Object
See also the file saffron.properties which holds the
character set system properties formerly set in this file.
| Modifier and Type | Class and Description |
|---|---|
static class |
Calcites.Arg0NullableArrayTypeInference |
static class |
Calcites.Arg1NullableArrayTypeInference |
| Modifier and Type | Field and Description |
|---|---|
static org.apache.calcite.sql.type.SqlReturnTypeInference |
ARG0_NULLABLE_ARRAY_RETURN_TYPE_INFERENCE |
static org.apache.calcite.sql.type.SqlReturnTypeInference |
ARG1_NULLABLE_ARRAY_RETURN_TYPE_INFERENCE |
| Modifier and Type | Method and Description |
|---|---|
static org.joda.time.DateTime |
calciteDateTimeLiteralToJoda(org.apache.calcite.rex.RexNode literal,
org.joda.time.DateTimeZone timeZone)
Translates "literal" (a TIMESTAMP or DATE literal) to milliseconds since the epoch using the provided
session time zone.
|
static org.joda.time.DateTime |
calciteDateToJoda(int date,
org.joda.time.DateTimeZone timeZone)
The inverse of
jodaToCalciteDate(DateTime, DateTimeZone). |
static org.joda.time.DateTime |
calciteTimestampToJoda(long timestamp,
org.joda.time.DateTimeZone timeZone)
The inverse of
jodaToCalciteTimestamp(DateTime, DateTimeZone). |
static org.apache.calcite.rel.type.RelDataType |
createSqlArrayTypeWithNullability(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory,
org.apache.calcite.sql.type.SqlTypeName elementTypeName,
boolean nullable)
Like RelDataTypeFactory.createSqlTypeWithNullability, but creates types that align best with how Druid
represents them.
|
static org.apache.calcite.rel.type.RelDataType |
createSqlType(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory,
org.apache.calcite.sql.type.SqlTypeName typeName)
Like RelDataTypeFactory.createSqlType, but creates types that align best with how Druid represents them.
|
static org.apache.calcite.rel.type.RelDataType |
createSqlTypeWithNullability(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory,
org.apache.calcite.sql.type.SqlTypeName typeName,
boolean nullable)
Like RelDataTypeFactory.createSqlTypeWithNullability, but creates types that align best with how Druid
represents them.
|
static Charset |
defaultCharset() |
static String |
escapeStringLiteral(String s) |
static String |
findUnusedPrefixForDigits(String basePrefix,
Iterable<String> strings)
Find a string that is either equal to "basePrefix", or basePrefix prepended by underscores, and where nothing in
"strings" starts with prefix plus a digit.
|
static ColumnType |
getColumnTypeForRelDataType(org.apache.calcite.rel.type.RelDataType type)
Convert
RelDataType to the most appropriate ValueType
Caller who want to coerce all ARRAY types to STRING can set `druid.expressions.allowArrayToStringCast`
runtime property in ExpressionProcessingConfig |
static StringComparator |
getStringComparatorForRelDataType(org.apache.calcite.rel.type.RelDataType dataType) |
static StringComparator |
getStringComparatorForValueType(ColumnType valueType) |
static ColumnType |
getValueTypeForRelDataTypeFull(org.apache.calcite.rel.type.RelDataType type)
Convert
RelDataType to the most appropriate ValueType |
static boolean |
isDoubleType(org.apache.calcite.sql.type.SqlTypeName sqlTypeName) |
static boolean |
isLongType(org.apache.calcite.sql.type.SqlTypeName sqlTypeName) |
static int |
jodaToCalciteDate(org.joda.time.DateTime dateTime,
org.joda.time.DateTimeZone timeZone)
Calcite expects "DATE" types to be number of days from the epoch to the UTC date matching the local time fields.
|
static org.apache.calcite.util.DateString |
jodaToCalciteDateString(org.joda.time.DateTime dateTime,
org.joda.time.DateTimeZone timeZone)
Calcite expects DATE literals to be represented by DateStrings in the local time zone.
|
static long |
jodaToCalciteTimestamp(org.joda.time.DateTime dateTime,
org.joda.time.DateTimeZone timeZone)
Calcite expects "TIMESTAMP" types to be an instant that has the expected local time fields if printed as UTC.
|
static org.apache.calcite.rex.RexLiteral |
jodaToCalciteTimestampLiteral(org.apache.calcite.rex.RexBuilder rexBuilder,
org.joda.time.DateTime dateTime,
org.joda.time.DateTimeZone sessionTimeZone,
int precision)
Creates a Calcite TIMESTAMP literal from a Joda DateTime.
|
static org.apache.calcite.util.TimeString |
jodaToCalciteTimeString(org.joda.time.DateTime dateTime,
org.joda.time.DateTimeZone timeZone)
Calcite expects TIME literals to be represented by TimeStrings in the local time zone.
|
static String |
makePrefixedName(String prefix,
String suffix) |
static Class<?> |
sqlTypeNameJdbcToJavaClass(org.apache.calcite.sql.type.SqlTypeName typeName) |
public static final org.apache.calcite.sql.type.SqlReturnTypeInference ARG0_NULLABLE_ARRAY_RETURN_TYPE_INFERENCE
public static final org.apache.calcite.sql.type.SqlReturnTypeInference ARG1_NULLABLE_ARRAY_RETURN_TYPE_INFERENCE
public static Charset defaultCharset()
@Nullable public static ColumnType getColumnTypeForRelDataType(org.apache.calcite.rel.type.RelDataType type)
RelDataType to the most appropriate ValueType
Caller who want to coerce all ARRAY types to STRING can set `druid.expressions.allowArrayToStringCast`
runtime property in ExpressionProcessingConfig@Nullable public static ColumnType getValueTypeForRelDataTypeFull(org.apache.calcite.rel.type.RelDataType type)
RelDataType to the most appropriate ValueTypepublic static boolean isDoubleType(org.apache.calcite.sql.type.SqlTypeName sqlTypeName)
public static boolean isLongType(org.apache.calcite.sql.type.SqlTypeName sqlTypeName)
public static StringComparator getStringComparatorForRelDataType(org.apache.calcite.rel.type.RelDataType dataType)
public static StringComparator getStringComparatorForValueType(ColumnType valueType)
public static org.apache.calcite.rel.type.RelDataType createSqlType(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory,
org.apache.calcite.sql.type.SqlTypeName typeName)
public static org.apache.calcite.rel.type.RelDataType createSqlTypeWithNullability(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory,
org.apache.calcite.sql.type.SqlTypeName typeName,
boolean nullable)
public static org.apache.calcite.rel.type.RelDataType createSqlArrayTypeWithNullability(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory,
org.apache.calcite.sql.type.SqlTypeName elementTypeName,
boolean nullable)
public static long jodaToCalciteTimestamp(org.joda.time.DateTime dateTime,
org.joda.time.DateTimeZone timeZone)
dateTime - joda timestamptimeZone - session time zonepublic static int jodaToCalciteDate(org.joda.time.DateTime dateTime,
org.joda.time.DateTimeZone timeZone)
dateTime - joda timestamptimeZone - session time zonepublic static org.apache.calcite.rex.RexLiteral jodaToCalciteTimestampLiteral(org.apache.calcite.rex.RexBuilder rexBuilder,
org.joda.time.DateTime dateTime,
org.joda.time.DateTimeZone sessionTimeZone,
int precision)
dateTime - joda timestampsessionTimeZone - session time zonepublic static org.apache.calcite.util.TimeString jodaToCalciteTimeString(org.joda.time.DateTime dateTime,
org.joda.time.DateTimeZone timeZone)
dateTime - joda timestamptimeZone - session time zonepublic static org.apache.calcite.util.DateString jodaToCalciteDateString(org.joda.time.DateTime dateTime,
org.joda.time.DateTimeZone timeZone)
dateTime - joda timestamptimeZone - session time zonepublic static org.joda.time.DateTime calciteDateTimeLiteralToJoda(org.apache.calcite.rex.RexNode literal,
org.joda.time.DateTimeZone timeZone)
literal - TIMESTAMP or DATE literaltimeZone - session time zonepublic static org.joda.time.DateTime calciteTimestampToJoda(long timestamp,
org.joda.time.DateTimeZone timeZone)
jodaToCalciteTimestamp(DateTime, DateTimeZone).timestamp - Calcite style timestamptimeZone - session time zonepublic static org.joda.time.DateTime calciteDateToJoda(int date,
org.joda.time.DateTimeZone timeZone)
jodaToCalciteDate(DateTime, DateTimeZone).date - Calcite style datetimeZone - session time zonepublic static String findUnusedPrefixForDigits(String basePrefix, Iterable<String> strings)
public static Class<?> sqlTypeNameJdbcToJavaClass(org.apache.calcite.sql.type.SqlTypeName typeName)
Copyright © 2011–2022 The Apache Software Foundation. All rights reserved.