public class DateTimeUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.Long |
MAX_UNIX_MILLIS |
static java.lang.Long |
MILLIS_PER_DAY |
static java.lang.Long |
MIN_UNIX_MILLIS |
Constructor and Description |
---|
DateTimeUtils() |
Modifier and Type | Method and Description |
---|---|
static DateTimeFormatter |
findDateTimePattern(java.lang.String str) |
static DateTimeFormatter |
findDateTimePattern(java.lang.String str,
org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableMap<org.apache.beam.sdk.extensions.sql.zetasql.DateTimeUtils.TimestampPatterns,DateTimeFormatter> patternMap) |
static java.lang.String |
formatTimestampWithTimeZone(DateTime dt) |
static DateTime |
parseDate(java.lang.String str) |
static com.google.zetasql.Value |
parseDateToValue(java.lang.String dateString) |
static DateTime |
parseTime(java.lang.String str) |
static DateTime |
parseTimestampWithLocalTimeZone(java.lang.String str) |
static DateTime |
parseTimestampWithoutTimeZone(java.lang.String str) |
static DateTime |
parseTimestampWithTimeZone(java.lang.String str) |
static com.google.zetasql.Value |
parseTimestampWithTZToValue(java.lang.String timestampString) |
static DateTime |
parseTimestampWithUTCTimeZone(java.lang.String str) |
static com.google.zetasql.Value |
parseTimeToValue(java.lang.String timeString) |
static @Nullable java.lang.Long |
validateTimeInterval(@Nullable java.lang.Long arg,
org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.avatica.util.TimeUnit unit)
This function validates that interval is compatible with ZetaSQL timestamp values range.
|
static @Nullable java.lang.Long |
validateTimestamp(@Nullable java.lang.Long ts)
This function validates that Long representation of timestamp is compatible with ZetaSQL
timestamp values range.
|
public static final java.lang.Long MILLIS_PER_DAY
public static final java.lang.Long MIN_UNIX_MILLIS
public static final java.lang.Long MAX_UNIX_MILLIS
public static DateTimeFormatter findDateTimePattern(java.lang.String str)
public static DateTimeFormatter findDateTimePattern(java.lang.String str, org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableMap<org.apache.beam.sdk.extensions.sql.zetasql.DateTimeUtils.TimestampPatterns,DateTimeFormatter> patternMap)
public static DateTime parseTimestampWithUTCTimeZone(java.lang.String str)
public static DateTime parseTimestampWithLocalTimeZone(java.lang.String str)
public static DateTime parseTimestampWithTimeZone(java.lang.String str)
public static java.lang.String formatTimestampWithTimeZone(DateTime dt)
public static DateTime parseTimestampWithoutTimeZone(java.lang.String str)
public static DateTime parseDate(java.lang.String str)
public static DateTime parseTime(java.lang.String str)
public static com.google.zetasql.Value parseDateToValue(java.lang.String dateString)
public static com.google.zetasql.Value parseTimeToValue(java.lang.String timeString)
public static com.google.zetasql.Value parseTimestampWithTZToValue(java.lang.String timestampString)
public static @Nullable java.lang.Long validateTimestamp(@Nullable java.lang.Long ts)
Invoked via reflection. @see SqlOperators
ts
- Timestamp to validate.public static @Nullable java.lang.Long validateTimeInterval(@Nullable java.lang.Long arg, org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.avatica.util.TimeUnit unit)
ZetaSQL validates that if we represent interval in milliseconds, it will fit into Long.
In case of SECOND or smaller time unit, it converts timestamp to microseconds, so we need to convert those to microsecond and verify that we do not cause overflow.
Invoked via reflection. @see SqlOperators
arg
- Argument for the interval.unit
- Time unit used in this interval.