Skip to content

Commit

Permalink
minor, in Tuple, measure auto convert to short and byte
Browse files Browse the repository at this point in the history
  • Loading branch information
liyang-kylin committed Sep 13, 2016
1 parent 0362c2b commit 5dc5ac8
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ public void setMeasureValue(int idx, Object fieldValue) {
fieldValue = ((BigDecimal) fieldValue).doubleValue();
} else if ("integer".equals(dataType) && fieldValue instanceof Number) {
fieldValue = ((Number) fieldValue).intValue();
} else if ("smallint".equals(dataType) && fieldValue instanceof Number) {
fieldValue = ((Number) fieldValue).shortValue();
} else if ("tinyint".equals(dataType)) {
fieldValue = ((Number) fieldValue).byteValue();
} else if ("float".equals(dataType) && fieldValue instanceof BigDecimal) {
fieldValue = ((BigDecimal) fieldValue).floatValue();
} else if ("date".equals(dataType) && fieldValue instanceof Long) {
Expand Down Expand Up @@ -185,11 +189,11 @@ public static Object convertOptiqCellValue(String strValue, String dataTypeName)
return Long.valueOf(DateFormat.stringToMillis(strValue));
} else if ("tinyint".equals(dataTypeName)) {
return Byte.valueOf(strValue);
} else if ("short".equals(dataTypeName) || "smallint".equals(dataTypeName)) {
} else if ("smallint".equals(dataTypeName)) {
return Short.valueOf(strValue);
} else if ("integer".equals(dataTypeName)) {
return Integer.valueOf(strValue);
} else if ("long".equals(dataTypeName) || "bigint".equals(dataTypeName)) {
} else if ("bigint".equals(dataTypeName)) {
return Long.valueOf(strValue);
} else if ("double".equals(dataTypeName)) {
return Double.valueOf(strValue);
Expand Down

0 comments on commit 5dc5ac8

Please sign in to comment.