|
80 | 80 | import java.security.NoSuchAlgorithmException;
|
81 | 81 | import java.sql.Date;
|
82 | 82 | import java.sql.Timestamp;
|
83 |
| -import java.time.format.DateTimeFormatter; |
84 | 83 | import java.util.ArrayList;
|
85 | 84 | import java.util.Arrays;
|
86 | 85 | import java.util.Collection;
|
@@ -1449,17 +1448,16 @@ public void createOrcDateFile(Path file, int minYear, int maxYear
|
1449 | 1448 | batch = reader.getSchema().createRowBatch(1000);
|
1450 | 1449 | TimestampColumnVector times = (TimestampColumnVector) batch.cols[0];
|
1451 | 1450 | LongColumnVector dates = (LongColumnVector) batch.cols[1];
|
1452 |
| - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSS"); |
1453 | 1451 | for (int year = minYear; year < maxYear; ++year) {
|
1454 | 1452 | rows.nextBatch(batch);
|
1455 | 1453 | assertEquals(1000, batch.size);
|
1456 | 1454 | for(int row = 0; row < 1000; ++row) {
|
1457 |
| - String expectedStr = String.format("%04d-05-05 12:34:56.%04d", year, 2*row); |
1458 |
| - assertEquals("row " + row, expectedStr, |
1459 |
| - formatter.format(times.asScratchTimestamp(row).toLocalDateTime())); |
1460 |
| - assertEquals(0, times.time[row] % 1000); |
1461 |
| - assertTrue("nano " + row + " = " + times.nanos[row], |
1462 |
| - times.nanos[row] >= 0 && times.nanos[row] < 1_000_000_000); |
| 1455 | + Timestamp expected = Timestamp.valueOf( |
| 1456 | + String.format("%04d-05-05 12:34:56.%04d", year, 2*row)); |
| 1457 | + assertEquals("ms row " + row + " " + expected, expected.getTime(), |
| 1458 | + times.time[row]); |
| 1459 | + assertEquals("nanos row " + row + " " + expected, expected.getNanos(), |
| 1460 | + times.nanos[row]); |
1463 | 1461 | assertEquals("year " + year + " row " + row,
|
1464 | 1462 | Integer.toString(year) + "-12-25",
|
1465 | 1463 | new DateWritable((int) dates.vector[row]).toString());
|
|
0 commit comments