@Override public SqlDate getExpectedValue(int start, int length) { if (length == 0) { return null; } return new SqlDate(start + length - 1); }
private static Optional<LocalDate> getDateValue(ConnectorSession session, Type type, Block block) { return block.isNull(0) ? Optional.empty() : Optional.of(LocalDate.ofEpochDay(((SqlDate) type.getObjectValue(session, block, 0)).getDays())); }
private static SqlDate intToSqlDate(Integer input) { if (input == null) { return null; } return new SqlDate(input); } }
Object convertedValue; if (prestoValue instanceof SqlDate) { convertedValue = LocalDate.ofEpochDay(((SqlDate) prestoValue).getDays());
@Override public SqlDate getExpectedValue(int start, int length) { if (length == 0) { return null; } return new SqlDate(start + length - 1); }
Object convertedValue; if (prestoValue instanceof SqlDate) { convertedValue = LocalDate.ofEpochDay(((SqlDate) prestoValue).getDays());
private static SqlDate intToSqlDate(Integer input) { if (input == null) { return null; } return new SqlDate(input); } }
int days = ((SqlDate) value).getDays(); LocalDate localDate = LocalDate.ofEpochDay(days); ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault());
private static SqlDate toDate(DateTime dateTime) { return new SqlDate((int) TimeUnit.MILLISECONDS.toDays(dateTime.getMillis())); } }
int days = ((SqlDate) value).getDays(); LocalDate localDate = LocalDate.ofEpochDay(days); ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault());
@Override public Object getObjectValue(ConnectorSession session, Block block, int position) { if (block.isNull(position)) { return null; } int days = block.getInt(position, 0); return new SqlDate(days); }
int days = ((SqlDate) value).getDays(); LocalDate localDate = LocalDate.ofEpochDay(days); ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault());
private static SqlDate toDate(DateTime dateTime) { return new SqlDate((int) TimeUnit.MILLISECONDS.toDays(dateTime.getMillis())); } }
int days = ((SqlDate) value).getDays(); LocalDate localDate = LocalDate.ofEpochDay(days); ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault());
private static SqlDate toDate(DateTime dateDate) { long millis = dateDate.getMillis(); return new SqlDate(toIntExact(MILLISECONDS.toDays(millis))); }
@Test public void testShardStatsDateTimestamp() { long minDate = sqlDate(2001, 8, 22).getDays(); long maxDate = sqlDate(2005, 4, 22).getDays(); long maxTimestamp = sqlTimestamp(2002, 4, 13, 6, 7, 8).getMillisUtc(); long minTimestamp = sqlTimestamp(2001, 3, 15, 9, 10, 11).getMillisUtc(); List<ColumnStats> stats = columnStats(types(DATE, TIMESTAMP), row(minDate, maxTimestamp), row(maxDate, minTimestamp)); assertColumnStats(stats, 1, minDate, maxDate); assertColumnStats(stats, 2, minTimestamp, maxTimestamp); }
private static SqlDate toDate(DateTime dateDate) { long millis = dateDate.getMillis(); return new SqlDate(toIntExact(MILLISECONDS.toDays(millis))); }
return new DateOrcPredicate( expectedValues.stream() .map(value -> value == null ? null : (long) ((SqlDate) value).getDays()) .collect(toList()), format == DWRF);