Skip to content

Commit 994a09a

Browse files
committed
Remove unused methods and code
1 parent c201f1e commit 994a09a

File tree

1 file changed

+0
-55
lines changed

1 file changed

+0
-55
lines changed

core/trino-main/src/main/java/io/trino/util/DateTimeUtils.java

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@
2020
import io.trino.sql.tree.IntervalLiteral.IntervalField;
2121
import org.assertj.core.util.VisibleForTesting;
2222
import org.joda.time.DateTime;
23-
import org.joda.time.DateTimeZone;
2423
import org.joda.time.DurationFieldType;
2524
import org.joda.time.MutablePeriod;
2625
import org.joda.time.Period;
2726
import org.joda.time.ReadWritablePeriod;
28-
import org.joda.time.chrono.ISOChronology;
2927
import org.joda.time.format.DateTimeFormat;
3028
import org.joda.time.format.DateTimeFormatter;
3129
import org.joda.time.format.DateTimeFormatterBuilder;
@@ -48,12 +46,9 @@
4846

4947
import static com.google.common.base.Preconditions.checkArgument;
5048
import static io.trino.spi.StandardErrorCode.INVALID_FUNCTION_ARGUMENT;
51-
import static io.trino.spi.type.DateTimeEncoding.unpackMillisUtc;
5249
import static io.trino.util.DateTimeZoneIndex.getChronology;
5350
import static io.trino.util.DateTimeZoneIndex.getDateTimeZone;
5451
import static io.trino.util.DateTimeZoneIndex.packDateTimeWithZone;
55-
import static io.trino.util.DateTimeZoneIndex.unpackChronology;
56-
import static io.trino.util.DateTimeZoneIndex.unpackDateTimeZone;
5752
import static java.lang.Math.toIntExact;
5853
import static java.lang.String.format;
5954

@@ -136,7 +131,6 @@ public static String printDate(int days)
136131
return DATE_FORMATTER.print(TimeUnit.DAYS.toMillis(days));
137132
}
138133

139-
private static final DateTimeFormatter TIMESTAMP_WITH_TIME_ZONE_FORMATTER;
140134
private static final DateTimeFormatter TIMESTAMP_WITH_OR_WITHOUT_TIME_ZONE_FORMATTER;
141135

142136
static {
@@ -165,10 +159,6 @@ public static String printDate(int days)
165159
DateTimeFormat.forPattern("yyyyyy-M-d H:m:s.SSS ZZZ").getParser()};
166160

167161
DateTimePrinter timestampWithTimeZonePrinter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS ZZZ").getPrinter();
168-
TIMESTAMP_WITH_TIME_ZONE_FORMATTER = new DateTimeFormatterBuilder()
169-
.append(timestampWithTimeZonePrinter, timestampWithTimeZoneParser)
170-
.toFormatter()
171-
.withOffsetParsed();
172162

173163
DateTimeParser[] timestampWithOrWithoutTimeZoneParser = Stream.concat(Stream.of(timestampWithoutTimeZoneParser), Stream.of(timestampWithTimeZoneParser))
174164
.toArray(DateTimeParser[]::new);
@@ -194,15 +184,7 @@ public static long convertToTimestampWithTimeZone(TimeZoneKey timeZoneKey, Strin
194184
return packDateTimeWithZone(dateTime);
195185
}
196186

197-
public static String printTimestampWithTimeZone(long timestampWithTimeZone)
198-
{
199-
ISOChronology chronology = unpackChronology(timestampWithTimeZone);
200-
long millis = unpackMillisUtc(timestampWithTimeZone);
201-
return TIMESTAMP_WITH_TIME_ZONE_FORMATTER.withChronology(chronology).print(millis);
202-
}
203-
204187
private static final DateTimeFormatter TIME_FORMATTER;
205-
private static final DateTimeFormatter TIME_WITH_TIME_ZONE_FORMATTER;
206188

207189
static {
208190
DateTimeParser[] timeWithoutTimeZoneParser = {
@@ -211,22 +193,6 @@ public static String printTimestampWithTimeZone(long timestampWithTimeZone)
211193
DateTimeFormat.forPattern("H:m:s.SSS").getParser()};
212194
DateTimePrinter timeWithoutTimeZonePrinter = DateTimeFormat.forPattern("HH:mm:ss.SSS").getPrinter();
213195
TIME_FORMATTER = new DateTimeFormatterBuilder().append(timeWithoutTimeZonePrinter, timeWithoutTimeZoneParser).toFormatter().withZoneUTC();
214-
215-
DateTimeParser[] timeWithTimeZoneParser = {
216-
DateTimeFormat.forPattern("H:mZ").getParser(),
217-
DateTimeFormat.forPattern("H:m Z").getParser(),
218-
DateTimeFormat.forPattern("H:m:sZ").getParser(),
219-
DateTimeFormat.forPattern("H:m:s Z").getParser(),
220-
DateTimeFormat.forPattern("H:m:s.SSSZ").getParser(),
221-
DateTimeFormat.forPattern("H:m:s.SSS Z").getParser(),
222-
DateTimeFormat.forPattern("H:mZZZ").getParser(),
223-
DateTimeFormat.forPattern("H:m ZZZ").getParser(),
224-
DateTimeFormat.forPattern("H:m:sZZZ").getParser(),
225-
DateTimeFormat.forPattern("H:m:s ZZZ").getParser(),
226-
DateTimeFormat.forPattern("H:m:s.SSSZZZ").getParser(),
227-
DateTimeFormat.forPattern("H:m:s.SSS ZZZ").getParser()};
228-
DateTimePrinter timeWithTimeZonePrinter = DateTimeFormat.forPattern("HH:mm:ss.SSS ZZZ").getPrinter();
229-
TIME_WITH_TIME_ZONE_FORMATTER = new DateTimeFormatterBuilder().append(timeWithTimeZonePrinter, timeWithTimeZoneParser).toFormatter().withOffsetParsed();
230196
}
231197

232198
/**
@@ -241,27 +207,6 @@ public static long parseLegacyTime(TimeZoneKey timeZoneKey, String value)
241207
return TIME_FORMATTER.withZone(getDateTimeZone(timeZoneKey)).parseMillis(value);
242208
}
243209

244-
public static String printTimeWithTimeZone(long timeWithTimeZone)
245-
{
246-
DateTimeZone timeZone = unpackDateTimeZone(timeWithTimeZone);
247-
long millis = unpackMillisUtc(timeWithTimeZone);
248-
return TIME_WITH_TIME_ZONE_FORMATTER.withZone(timeZone).print(millis);
249-
}
250-
251-
public static String printTimeWithoutTimeZone(long value)
252-
{
253-
return TIME_FORMATTER.print(value);
254-
}
255-
256-
/**
257-
* @deprecated applicable in legacy timestamp semantics only
258-
*/
259-
@Deprecated
260-
public static String printTimeWithoutTimeZone(TimeZoneKey timeZoneKey, long value)
261-
{
262-
return TIME_FORMATTER.withZone(getDateTimeZone(timeZoneKey)).print(value);
263-
}
264-
265210
private static final int YEAR_FIELD = 0;
266211
private static final int MONTH_FIELD = 1;
267212
private static final int DAY_FIELD = 3;

0 commit comments

Comments
 (0)