imbajin commented on code in PR #648:
URL:
https://github.com/apache/incubator-hugegraph-toolchain/pull/648#discussion_r1910005228
##########
hugegraph-loader/src/main/java/org/apache/hugegraph/loader/util/DataTypeUtil.java:
##########
@@ -124,63 +121,90 @@ public static UUID parseUUID(String key, Object rawValue)
{
rawValue.getClass()));
}
- private static Object parseSingleValue(String key, Object rawValue,
- DataType dataType,
+ private static Object parseSingleValue(String key, Object rawValue,
DataType dataType,
InputSource source) {
// Trim space if raw value is string
Object value = rawValue;
- if (rawValue instanceof String) {
+ boolean isString = rawValue instanceof String;
+ if (isString) {
value = ((String) rawValue).trim();
}
if (dataType.isNumber()) {
return parseNumber(key, value, dataType);
- } else if (dataType.isBoolean()) {
- return parseBoolean(key, value);
- } else if (dataType.isDate()) {
- E.checkState(source instanceof FileSource,
- "Only accept FileSource when convert String value " +
- "to Date, but got '%s'", source.getClass().getName());
- String dateFormat = ((FileSource) source).dateFormat();
- String timeZone = ((FileSource) source).timeZone();
+ }
+ switch (dataType) {
+ case TEXT:
+ if (!isString) {
+ value = rawValue.toString();
Review Comment:
seems the logic is redundant?
`TEXT -> value.toString()` is enough?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]