Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,8 @@ private boolean isOwner(UUID nodeId, GridDhtPartitionTopology top, int parts) {

/** */
private static Object unwrap(Object val, GridCacheContext<?, ?> cctx, boolean keepBinary) {
// Fast path: simple values have nothing to unwrap.
if (val == null || QueryUtils.isSqlType(val.getClass()))
// Fast path: simple values have nothing to unwrap. Numbers and strings skip the lookup among SQL types.
if (val == null || val instanceof Number || val instanceof String || QueryUtils.isSqlType(val.getClass()))
return val;

return cctx.unwrapBinaryIfNeeded(val, keepBinary, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,16 @@ public static boolean hasScale(RelDataType type) {

/** */
public static @Nullable Object toInternal(DataContext ctx, @Nullable Object val, Type storageType) {
if (val == null)
return null;
else if (storageType == java.sql.Date.class)
// Fast path: numbers and strings of the storage type are kept as is. The method is small to be inlined.
if (val == null || storageType == val.getClass() && (val instanceof Number || val instanceof String))
return val;

return toInternal0(ctx, val, storageType);
}

/** */
private static Object toInternal0(DataContext ctx, Object val, Type storageType) {
if (storageType == java.sql.Date.class)
return (int)(toLong(ctx, val) / DateTimeUtils.MILLIS_PER_DAY);
else if (storageType == LocalDate.class)
return (int)(toLong(ctx, val) / DateTimeUtils.MILLIS_PER_DAY);
Expand Down
Loading