private static DateTimeField getTimeField(ISOChronology chronology, Slice unit) { String unitString = unit.toStringUtf8().toLowerCase(ENGLISH); switch (unitString) { case "millisecond": return chronology.millisOfSecond(); case "second": return chronology.secondOfMinute(); case "minute": return chronology.minuteOfHour(); case "hour": return chronology.hourOfDay(); } throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "'" + unitString + "' is not a valid Time field"); }
@Description("hour of the day of the given time") @ScalarFunction("hour") @SqlType(StandardTypes.BIGINT) public static long hourFromTimeWithTimeZone(@SqlType(StandardTypes.TIME_WITH_TIME_ZONE) long timeWithTimeZone) { return unpackChronology(timeWithTimeZone).hourOfDay().get(unpackMillisUtc(timeWithTimeZone)); }
@Description("hour of the day of the given timestamp") @ScalarFunction("hour") @SqlType(StandardTypes.BIGINT) public static long hourFromTimestampWithTimeZone(@SqlType(StandardTypes.TIMESTAMP_WITH_TIME_ZONE) long timestampWithTimeZone) { return unpackChronology(timestampWithTimeZone).hourOfDay().get(unpackMillisUtc(timestampWithTimeZone)); }
@Description("hour of the day of the given timestamp") @ScalarFunction("hour") @SqlType(StandardTypes.BIGINT) public static long hourFromTimestamp(ConnectorSession session, @SqlType(StandardTypes.TIMESTAMP) long timestamp) { if (session.isLegacyTimestamp()) { return getChronology(session.getTimeZoneKey()).hourOfDay().get(timestamp); } else { return HOUR_OF_DAY.get(timestamp); } }
@Description("hour of the day of the given time") @ScalarFunction("hour") @SqlType(StandardTypes.BIGINT) public static long hourFromTime(ConnectorSession session, @SqlType(StandardTypes.TIME) long time) { if (session.isLegacyTimestamp()) { return getChronology(session.getTimeZoneKey()).hourOfDay().get(time); } else { return HOUR_OF_DAY.get(time); } }
private static DateTimeField getTimestampField(ISOChronology chronology, Slice unit) { String unitString = unit.toStringUtf8().toLowerCase(ENGLISH); switch (unitString) { case "millisecond": return chronology.millisOfSecond(); case "second": return chronology.secondOfMinute(); case "minute": return chronology.minuteOfHour(); case "hour": return chronology.hourOfDay(); case "day": return chronology.dayOfMonth(); case "week": return chronology.weekOfWeekyear(); case "month": return chronology.monthOfYear(); case "quarter": return QUARTER_OF_YEAR.getField(chronology); case "year": return chronology.year(); } throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "'" + unitString + "' is not a valid Timestamp field"); }
private static DateTimeField getTimeField(ISOChronology chronology, Slice unit) { String unitString = unit.toStringUtf8().toLowerCase(ENGLISH); switch (unitString) { case "millisecond": return chronology.millisOfSecond(); case "second": return chronology.secondOfMinute(); case "minute": return chronology.minuteOfHour(); case "hour": return chronology.hourOfDay(); } throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "'" + unitString + "' is not a valid Time field"); }
private static DateTimeField getTimeField(ISOChronology chronology, Slice unit) { String unitString = unit.toStringUtf8().toLowerCase(ENGLISH); switch (unitString) { case "millisecond": return chronology.millisOfSecond(); case "second": return chronology.secondOfMinute(); case "minute": return chronology.minuteOfHour(); case "hour": return chronology.hourOfDay(); } throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "'" + unitString + "' is not a valid Time field"); }
@Description("hour of the day of the given time") @ScalarFunction("hour") @SqlType(StandardTypes.BIGINT) public static long hourFromTimeWithTimeZone(@SqlType(StandardTypes.TIME_WITH_TIME_ZONE) long timeWithTimeZone) { return unpackChronology(timeWithTimeZone).hourOfDay().get(unpackMillisUtc(timeWithTimeZone)); }
@Description("hour of the day of the given timestamp") @ScalarFunction("hour") @SqlType(StandardTypes.BIGINT) public static long hourFromTimestamp(ConnectorSession session, @SqlType(StandardTypes.TIMESTAMP) long timestamp) { return getChronology(session.getTimeZoneKey()).hourOfDay().get(timestamp); }
@Description("hour of the day of the given timestamp") @ScalarFunction("hour") @SqlType(StandardTypes.BIGINT) public static long hourFromTimestampWithTimeZone(@SqlType(StandardTypes.TIMESTAMP_WITH_TIME_ZONE) long timestampWithTimeZone) { return unpackChronology(timestampWithTimeZone).hourOfDay().get(unpackMillisUtc(timestampWithTimeZone)); }
@Description("hour of the day of the given time") @ScalarFunction("hour") @SqlType(StandardTypes.BIGINT) public static long hourFromTimeWithTimeZone(@SqlType(StandardTypes.TIME_WITH_TIME_ZONE) long timeWithTimeZone) { return unpackChronology(timeWithTimeZone).hourOfDay().get(unpackMillisUtc(timeWithTimeZone)); }
@Description("hour of the day of the given time") @ScalarFunction("hour") @SqlType(StandardTypes.BIGINT) public static long hourFromTime(ConnectorSession session, @SqlType(StandardTypes.TIME) long time) { return getChronology(session.getTimeZoneKey()).hourOfDay().get(time); }
@Description("hour of the day of the given timestamp") @ScalarFunction("hour") @SqlType(StandardTypes.BIGINT) public static long hourFromTimestampWithTimeZone(@SqlType(StandardTypes.TIMESTAMP_WITH_TIME_ZONE) long timestampWithTimeZone) { return unpackChronology(timestampWithTimeZone).hourOfDay().get(unpackMillisUtc(timestampWithTimeZone)); }
@Description("hour of the day of the given timestamp") @ScalarFunction("hour") @SqlType(StandardTypes.BIGINT) public static long hourFromTimestampWithTimeZone(@SqlType(StandardTypes.TIMESTAMP_WITH_TIME_ZONE) long timestampWithTimeZone) { return unpackChronology(timestampWithTimeZone).hourOfDay().get(unpackMillisUtc(timestampWithTimeZone)); }
@Description("hour of the day of the given time") @ScalarFunction("hour") @SqlType(StandardTypes.BIGINT) public static long hourFromTimeWithTimeZone(@SqlType(StandardTypes.TIME_WITH_TIME_ZONE) long timeWithTimeZone) { return unpackChronology(timeWithTimeZone).hourOfDay().get(unpackMillisUtc(timeWithTimeZone)); }
@Description("hour of the day of the given timestamp") @ScalarFunction("hour") @SqlType(StandardTypes.BIGINT) public static long hourFromTimestamp(ConnectorSession session, @SqlType(StandardTypes.TIMESTAMP) long timestamp) { if (session.isLegacyTimestamp()) { return getChronology(session.getTimeZoneKey()).hourOfDay().get(timestamp); } else { return HOUR_OF_DAY.get(timestamp); } }
@Description("hour of the day of the given time") @ScalarFunction("hour") @SqlType(StandardTypes.BIGINT) public static long hourFromTime(ConnectorSession session, @SqlType(StandardTypes.TIME) long time) { if (session.isLegacyTimestamp()) { return getChronology(session.getTimeZoneKey()).hourOfDay().get(time); } else { return HOUR_OF_DAY.get(time); } }
@Description("hour of the day of the given timestamp") @ScalarFunction("hour") @SqlType(StandardTypes.BIGINT) public static long hourFromTimestamp(ConnectorSession session, @SqlType(StandardTypes.TIMESTAMP) long timestamp) { if (session.isLegacyTimestamp()) { return getChronology(session.getTimeZoneKey()).hourOfDay().get(timestamp); } else { return HOUR_OF_DAY.get(timestamp); } }
@Description("hour of the day of the given time") @ScalarFunction("hour") @SqlType(StandardTypes.BIGINT) public static long hourFromTime(ConnectorSession session, @SqlType(StandardTypes.TIME) long time) { if (session.isLegacyTimestamp()) { return getChronology(session.getTimeZoneKey()).hourOfDay().get(time); } else { return HOUR_OF_DAY.get(time); } }