Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 2 additions & 41 deletions src/main/java/com/nvidia/spark/rapids/jni/GpuTimeZoneDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,28 +96,9 @@ public class GpuTimeZoneDB {
private static volatile HostColumnVector tzNameToIndexMap;

/**
* This is deprecated, will be removed.
*/
public static void cacheDatabaseAsync(int maxYear) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT:
Since this is an API of a Java library, we may have comments that this is deprecated, and the maxYear is ignored, because it calls cacheDatabaseAsync internally than just removing it.

public static void cacheDatabaseAsync(int maxYear) {
  cacheDatabaseAsync()
}

// start a new thread to load
Runnable runnable = () -> {
try {
cacheDatabaseImpl();
} catch (Exception e) {
log.error("cache timezone info cache failed", e);
}
};
Thread thread = Executors.defaultThreadFactory().newThread(runnable);
thread.setName("gpu-timezone-database-0");
thread.setDaemon(true);
thread.start();
}

/**
* This is the replacement of the above function.
* Load the timezone database asynchronously.
* This should be called on startup of an executor.
* Runs in a thread asynchronously.
* If `shutdown` was called ever, then will not load the cache
* If `shutdown` was called ever, then this will not reload the cache.
*/
public static void cacheDatabaseAsync() {
// start a new thread to load
Expand Down Expand Up @@ -154,14 +135,6 @@ public static void verifyDatabaseCached() {
}

/**
* This is deprecated, will be removed.
*/
public static void cacheDatabase(int maxYear) {
cacheDatabaseImpl();
}

/**
* This is the replacement of the above function
* Cache the database. This will take some time like several seconds.
* If one `cacheDatabase` is running, other `cacheDatabase` will wait until
* caching is done.
Expand Down Expand Up @@ -421,18 +394,6 @@ private static HostColumnVector.DataType getDstDataType() {
}

/**
* This is deprecated, will be removed.
* Renamed to `getTimezoneInfo`.
*/
public static synchronized Table getTransitions() {
verifyDatabaseCached();
try (ColumnVector fixedInfo = fixedTransitions.copyToDevice();
ColumnVector dstInfo = dstRules.copyToDevice()) {
return new Table(fixedInfo, dstInfo);
}
}

/**
* Get the timezone info table, which contains two columns:
* - fixed transitions: LIST<STRUCT<utcInstant: int64, localInstant: int64,
* offset: int32>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static ColumnVector convertOrcTimezonesOnCPU(

@Test
void testConvertOrcTimezones() {
GpuTimeZoneDB.cacheDatabase(2200);
GpuTimeZoneDB.cacheDatabase();
GpuTimeZoneDB.verifyDatabaseCached();

// test time range: (0001-01-01 00:00:00, 9999-12-31 23:59:59)
Expand Down
Loading