public class Calcites extends Object
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.schema.SchemaPlus |
createRootSchema(org.apache.calcite.schema.Schema druidSchema,
AuthorizerMapper authorizerMapper) |
static Charset |
defaultCharset() |
static String |
escapeStringLiteral(String s) |
static String |
findOutputNamePrefix(String basePrefix,
NavigableSet<String> strings) |
static StringComparator |
getStringComparatorForSqlTypeName(org.apache.calcite.sql.type.SqlTypeName sqlTypeName) |
static StringComparator |
getStringComparatorForValueType(ValueType valueType) |
static ValueType |
getValueTypeForSqlTypeName(org.apache.calcite.sql.type.SqlTypeName sqlTypeName) |
static boolean |
isIntLiteral(org.apache.calcite.rex.RexNode rexNode)
Checks if a RexNode is a literal int or not.
|
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.util.TimestampString |
jodaToCalciteTimestampString(org.joda.time.DateTime dateTime,
org.joda.time.DateTimeZone timeZone)
Calcite expects TIMESTAMP literals to be represented by TimestampStrings in the local time zone.
|
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 void |
setSystemProperties() |
public static void setSystemProperties()
public static Charset defaultCharset()
public static org.apache.calcite.schema.SchemaPlus createRootSchema(org.apache.calcite.schema.Schema druidSchema, AuthorizerMapper authorizerMapper)
public static ValueType getValueTypeForSqlTypeName(org.apache.calcite.sql.type.SqlTypeName sqlTypeName)
public static StringComparator getStringComparatorForSqlTypeName(org.apache.calcite.sql.type.SqlTypeName sqlTypeName)
public static StringComparator getStringComparatorForValueType(ValueType valueType)
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.util.TimestampString jodaToCalciteTimestampString(org.joda.time.DateTime dateTime, org.joda.time.DateTimeZone timeZone)
dateTime
- joda timestamptimeZone
- 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 boolean isIntLiteral(org.apache.calcite.rex.RexNode rexNode)
RexLiteral.intValue(literal)
can be
used to get the value of the literal.rexNode
- the nodepublic static String findOutputNamePrefix(String basePrefix, NavigableSet<String> strings)
Copyright © 2011–2018. All rights reserved.