diff --git a/src/main/java/org/fbase/service/mapping/Mapper.java b/src/main/java/org/fbase/service/mapping/Mapper.java index 6e8d386..01f4bc7 100644 --- a/src/main/java/org/fbase/service/mapping/Mapper.java +++ b/src/main/java/org/fbase/service/mapping/Mapper.java @@ -79,7 +79,6 @@ public static int convertRawToInt(Object obj, CProfile cProfile) { public static long convertRawToLong(Object obj, CProfile cProfile) { if (obj == null) return LONG_NULL; switch (DataType.valueOf(cProfile.getColDbTypeName())) { - case OID: case DATE: case TIMESTAMP: case TIMESTAMPTZ: @@ -91,6 +90,7 @@ public static long convertRawToLong(Object obj, CProfile cProfile) { } else if (obj instanceof LocalDate localDate) { return localDate.atStartOfDay(ZoneOffset.UTC).toEpochSecond(); } + case OID: case UINT32: return (Long) obj; default: diff --git a/src/main/java/org/fbase/storage/Converter.java b/src/main/java/org/fbase/storage/Converter.java index 8828b51..16b7e00 100644 --- a/src/main/java/org/fbase/storage/Converter.java +++ b/src/main/java/org/fbase/storage/Converter.java @@ -29,7 +29,6 @@ public int convertRawToInt(Object obj, CProfile cProfile) { if (cProfile.getColDbTypeName().contains("FIXEDSTRING")) return dimensionDAO.getOrLoad((String) obj); switch (DataType.valueOf(cProfile.getColDbTypeName())) { - case OID: case DATE: if (obj instanceof java.util.Date dt) { return dimensionDAO.getOrLoad(dt.toString()); @@ -46,6 +45,7 @@ public int convertRawToInt(Object obj, CProfile cProfile) { } else if (obj instanceof LocalDateTime localDateTime) { return Math.toIntExact(localDateTime.atZone(ZoneOffset.UTC).toInstant().toEpochMilli() / 1000); } + case OID: case UINT32: Long var = (Long) obj; return var.intValue(); @@ -70,8 +70,12 @@ public int convertRawToInt(Object obj, CProfile cProfile) { case FLOAT64: case FLOAT: case NUMERIC: - Double varD = (Double) obj; - return dimensionDAO.getOrLoad(varD); + if (obj instanceof BigDecimal bd) { + return dimensionDAO.getOrLoad(bd.doubleValue()); + } else { + Double varD = (Double) obj; + return dimensionDAO.getOrLoad(varD); + } case FLOAT32: Float varF = (Float) obj; return dimensionDAO.getOrLoad(varF.doubleValue()); @@ -98,7 +102,7 @@ public String convertIntToRaw(int objIndex, CProfile cProfile) { if (cProfile.getColDbTypeName().contains("FIXEDSTRING")) return dimensionDAO.getStringById(objIndex); return switch (DataType.valueOf(cProfile.getColDbTypeName())) { - case OID, DATE, ENUM8, ENUM16, FIXEDSTRING, CHAR, CLOB, NAME, TEXT, VARCHAR, VARCHAR2, NVARCHAR -> + case DATE, ENUM8, ENUM16, FIXEDSTRING, CHAR, CLOB, NAME, TEXT, VARCHAR, VARCHAR2, NVARCHAR -> dimensionDAO.getStringById(objIndex); case TIMESTAMP, TIMESTAMPTZ, DATETIME -> getDateForLongShorted(objIndex); case FLOAT64, FLOAT32, FLOAT, NUMERIC -> String.valueOf(dimensionDAO.getDoubleById(objIndex));