Skip to content

Commit

Permalink
ARROW-325: make TestArrowFile not dependent on timezone
Browse files Browse the repository at this point in the history
Author: Julien Le Dem <julien@dremio.com>

Closes #162 from julienledem/tz and squashes the following commits:

74b5ee8 [Julien Le Dem] ARROW-325: make TestArrowFile not dependent on timezone
  • Loading branch information
julienledem committed Oct 8, 2016
1 parent 1196691 commit eb1491a
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@
import org.apache.arrow.vector.complex.writer.BaseWriter.MapWriter;
import org.apache.arrow.vector.complex.writer.BigIntWriter;
import org.apache.arrow.vector.complex.writer.IntWriter;
import org.apache.arrow.vector.holders.NullableTimeStampHolder;
import org.apache.arrow.vector.schema.ArrowBuffer;
import org.apache.arrow.vector.schema.ArrowRecordBatch;
import org.apache.arrow.vector.types.Types.MinorType;
import org.apache.arrow.vector.types.pojo.Schema;
import org.joda.time.DateTimeZone;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
Expand All @@ -58,14 +60,18 @@ public class TestArrowFile {
private static final int COUNT = 10;
private BufferAllocator allocator;

private DateTimeZone defaultTimezone = DateTimeZone.getDefault();

@Before
public void init() {
DateTimeZone.setDefault(DateTimeZone.forOffsetHours(2));
allocator = new RootAllocator(Integer.MAX_VALUE);
}

@After
public void tearDown() {
allocator.close();
DateTimeZone.setDefault(defaultTimezone);
}

@Test
Expand Down Expand Up @@ -258,7 +264,9 @@ private void validateComplexContent(int count, NullableMapVector parent) {
Assert.assertEquals(i, rootReader.reader("int").readInteger().intValue());
Assert.assertEquals(i, rootReader.reader("bigInt").readLong().longValue());
Assert.assertEquals(i % 3, rootReader.reader("list").size());
Assert.assertEquals(i, rootReader.reader("map").reader("timestamp").readDateTime().getMillis() % COUNT);
NullableTimeStampHolder h = new NullableTimeStampHolder();
rootReader.reader("map").reader("timestamp").read(h);
Assert.assertEquals(i, h.value % COUNT);
}
}

Expand Down

0 comments on commit eb1491a

Please sign in to comment.