Class DateTimeUtils
java.lang.Object
org.apache.beam.sdk.extensions.sql.zetasql.DateTimeUtils
DateTimeUtils.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DateTimeFormatter
static DateTimeFormatter
findDateTimePattern
(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 String
static DateTime
static com.google.zetasql.Value
parseDateToValue
(String dateString) static DateTime
static DateTime
static DateTime
static DateTime
static com.google.zetasql.Value
parseTimestampWithTZToValue
(String timestampString) static DateTime
static com.google.zetasql.Value
parseTimeToValue
(String timeString) validateTimeInterval
(@Nullable 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.This function validates that Long representation of timestamp is compatible with ZetaSQL timestamp values range.
-
Field Details
-
MILLIS_PER_DAY
-
MIN_UNIX_MILLIS
-
MAX_UNIX_MILLIS
-
-
Constructor Details
-
DateTimeUtils
public DateTimeUtils()
-
-
Method Details
-
findDateTimePattern
-
findDateTimePattern
public static DateTimeFormatter findDateTimePattern(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) -
parseTimestampWithUTCTimeZone
-
parseTimestampWithLocalTimeZone
-
parseTimestampWithTimeZone
-
formatTimestampWithTimeZone
-
parseTimestampWithoutTimeZone
-
parseDate
-
parseTime
-
parseDateToValue
-
parseTimeToValue
-
parseTimestampWithTZToValue
-
validateTimestamp
This function validates that Long representation of timestamp is compatible with ZetaSQL timestamp values range.Invoked via reflection. @see SqlOperators
- Parameters:
ts
- Timestamp to validate.- Returns:
- Unchanged timestamp sent for validation.
-
validateTimeInterval
public static @Nullable Long validateTimeInterval(@Nullable 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.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
- Parameters:
arg
- Argument for the interval.unit
- Time unit used in this interval.- Returns:
- Argument for the interval.
-