@Override public Block toBlock(Type desiredType) { checkArgument(DATE.equals(desiredType), "type doesn't match: %s", desiredType); int numberOfRecords = numberOfRecords(); return new IntArrayBlock( numberOfRecords, Optional.ofNullable(nulls), dates == null ? new int[numberOfRecords] : dates); }
checkArgument(value instanceof Integer, "Expected value %d to be an instance of Integer, but is a %s", i, value.getClass().getSimpleName()); else if (BIGINT.equals(type) || DATE.equals(type) || TIMESTAMP.equals(type) || TIMESTAMP_WITH_TIME_ZONE.equals(type)) { checkArgument(value instanceof Integer || value instanceof Long, "Expected value %d to be an instance of Integer or Long, but is a %s", i, value.getClass().getSimpleName());
static OptionalDouble toStatsRepresentation(FunctionRegistry functionRegistry, ConnectorSession session, Type type, Object value) { if (convertibleToDoubleWithCast(type)) { InterpretedFunctionInvoker functionInvoker = new InterpretedFunctionInvoker(functionRegistry); Signature castSignature = functionRegistry.getCoercion(type, DoubleType.DOUBLE); return OptionalDouble.of((double) functionInvoker.invoke(castSignature, session, singletonList(value))); } if (DateType.DATE.equals(type)) { return OptionalDouble.of(((Long) value).doubleValue()); } return OptionalDouble.empty(); }
static OptionalDouble toStatsRepresentation(FunctionRegistry functionRegistry, ConnectorSession session, Type type, Object value) { if (convertibleToDoubleWithCast(type)) { InterpretedFunctionInvoker functionInvoker = new InterpretedFunctionInvoker(functionRegistry); Signature castSignature = functionRegistry.getCoercion(type, DoubleType.DOUBLE); return OptionalDouble.of((double) functionInvoker.invoke(castSignature, session, singletonList(value))); } if (DateType.DATE.equals(type)) { return OptionalDouble.of(((Long) value).doubleValue()); } return OptionalDouble.empty(); }
values.add(intBitsToFloat(toIntExact(type.getLong(block, position)))); else if (DATE.equals(type)) { values.add(DATE_FORMATTER.print(TimeUnit.DAYS.toMillis(type.getLong(block, position))));
statement.setBytes(parameter, type.getSlice(block, position).getBytes()); else if (DATE.equals(type)) {
statement.setBytes(parameter, type.getSlice(block, position).getBytes()); else if (DATE.equals(type)) {
format == DWRF); if (DATE.equals(type)) { return new DateOrcPredicate( expectedValues.stream()
private static boolean isValidPartitionType(Type type) { return type instanceof DecimalType || BOOLEAN.equals(type) || TINYINT.equals(type) || SMALLINT.equals(type) || INTEGER.equals(type) || BIGINT.equals(type) || REAL.equals(type) || DOUBLE.equals(type) || DATE.equals(type) || TIMESTAMP.equals(type) || isVarcharType(type) || isCharType(type); }
return binaryEncoding(type); if (DATE.equals(type)) { return dateEncoding(type);
return ((Number) value).doubleValue(); if (DATE.equals(type)) { return value;
return ((Number) value).doubleValue(); if (DATE.equals(type)) { return value;
.map(type -> format.supportsDate() || !DATE.equals(type) ? type : createUnboundedVarcharType()) .collect(toList());
if (DATE.equals(originalType)) { SqlDate date = (SqlDate) originalType.getObjectValue(connectorSession, block, position); LocalDateTime ldt = LocalDateTime.ofEpochSecond(TimeUnit.DAYS.toSeconds(date.getDays()), 0, ZoneOffset.UTC);
parseObjectColumn(column); else if (DATE.equals(type)) { parseLongColumn(column);
return new SqlVarbinary(((Slice) fieldFromCursor).getBytes()); if (DateType.DATE.equals(type)) { return new SqlDate(((Long) fieldFromCursor).intValue());
return new SqlVarbinary(((Slice) fieldFromCursor).getBytes()); if (DateType.DATE.equals(type)) { return new SqlDate(((Long) fieldFromCursor).intValue());
return cursor.getSlice(field); else if (DateType.DATE.equals(type)) { return cursor.getLong(field);
return cursor.getSlice(field); else if (DateType.DATE.equals(type)) { return cursor.getLong(field);
assertInstanceOf(value, SqlTimestamp.class); else if (DATE.equals(column.getType())) { assertInstanceOf(value, SqlDate.class);