Skip to content

Commit

Permalink
Replace Joda-Time libraries in presto-spark-testing
Browse files Browse the repository at this point in the history
Since Java 8 we have java.time packages which are equivalent to Joda and
the recommendation from the author of the Joda-Time is to migrate to
java.time(JSR-310) library.
  • Loading branch information
derek-xia authored and rschlussel committed Apr 14, 2022
1 parent 75542bf commit 2e9a297
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
6 changes: 0 additions & 6 deletions presto-spark-testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<scope>test</scope>
</dependency>

<!-- Just to make sure these two packages are built before the presto-spark-testing -->
<dependency>
<groupId>com.facebook.presto</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.hash.Hashing;
import io.airlift.units.Duration;
import org.joda.time.DateTimeZone;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
Expand All @@ -40,6 +39,7 @@
import java.io.OutputStream;
import java.io.UncheckedIOException;
import java.nio.file.Paths;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
Expand Down Expand Up @@ -85,7 +85,7 @@
public class TestPrestoSparkLauncherIntegrationSmokeTest
{
private static final Logger log = Logger.get(TestPrestoSparkLauncherIntegrationSmokeTest.class);
private static final DateTimeZone TIME_ZONE = DateTimeZone.forID("America/Bahia_Banderas");
private static final ZoneId TIME_ZONE = ZoneId.of("America/Bahia_Banderas");

private File tempDir;
private File sparkWorkDirectory;
Expand All @@ -104,7 +104,7 @@ public class TestPrestoSparkLauncherIntegrationSmokeTest
public void setUp()
throws Exception
{
assertEquals(DateTimeZone.getDefault(), TIME_ZONE, "Timezone not configured correctly. Add -Duser.timezone=America/Bahia_Banderas to your JVM arguments");
assertEquals(ZoneId.systemDefault(), TIME_ZONE, "Timezone not configured correctly. Add -Duser.timezone=America/Bahia_Banderas to your JVM arguments");
// the default temporary directory location on MacOS is not sharable to docker
tempDir = new File("/tmp", randomUUID().toString());
createDirectories(tempDir.toPath());
Expand Down Expand Up @@ -136,7 +136,7 @@ public void setUp()
hiveConnectorFactory,
ImmutableMap.of(
"hive.metastore.uri", "thrift://127.0.0.1:9083",
"hive.time-zone", TIME_ZONE.getID(),
"hive.time-zone", TIME_ZONE.getId(),
"hive.experimental-optimized-partition-update-serialization-enabled", "true"));
localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(), ImmutableMap.of());
// it may take some time for the docker container to start
Expand All @@ -161,7 +161,7 @@ public void setUp()
// hadoop native cannot be run within the spark docker container
// the getnetgrent dependency is missing
"hive.dfs.require-hadoop-native", "false",
"hive.time-zone", TIME_ZONE.getID()));
"hive.time-zone", TIME_ZONE.getId()));
storeProperties(new File(catalogDirectory, "tpch.properties"), ImmutableMap.of(
"connector.name", "tpch",
"tpch.splits-per-node", "4",
Expand Down

0 comments on commit 2e9a297

Please sign in to comment.