Github user hyunsik commented on a diff in the pull request:
https://github.com/apache/tajo/pull/652#discussion_r39255382
--- Diff: tajo-common/src/main/java/org/apache/tajo/datum/DatumFactory.java
---
@@ -107,53 +107,50 @@ public static Datum createFromString(DataType
dataType, String value) {
case INET4:
return createInet4(value);
default:
- throw new UnsupportedOperationException(dataType.toString());
+ throw new
TajoRuntimeException(Errors.ResultCode.UNSUPPORTED_DATATYPE,
dataType.toString());
}
}
public static Datum createFromBytes(DataType dataType, byte[] bytes) {
switch (dataType.getType()) {
- case BOOLEAN:
- return createBool(bytes[0]);
- case INT2:
- return createInt2(NumberUtil.toShort(bytes));
- case INT4:
- return createInt4(NumberUtil.toInt(bytes));
- case INT8:
- return createInt8(NumberUtil.toLong(bytes));
- case FLOAT4:
- return createFloat4(NumberUtil.toFloat(bytes));
- case FLOAT8:
- return createFloat8(NumberUtil.toDouble(bytes));
- case CHAR:
- return createChar(bytes);
- case TEXT:
- return createText(bytes);
- case DATE:
- return new DateDatum(NumberUtil.toInt(bytes));
- case TIME:
- return new TimeDatum(NumberUtil.toLong(bytes));
- case TIMESTAMP:
- return new TimestampDatum(NumberUtil.toLong(bytes));
- case BIT:
- return createBit(bytes[0]);
- case BLOB:
- return createBlob(bytes);
- case INET4:
- return createInet4(bytes);
- case PROTOBUF:
- ProtobufDatumFactory factory = ProtobufDatumFactory.get(dataType);
- Message.Builder builder = factory.newBuilder();
- try {
- builder.mergeFrom(bytes);
- return factory.createDatum(builder.build());
- } catch (IOException e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- default:
- throw new UnsupportedOperationException(dataType.toString());
+ case BOOLEAN:
--- End diff --
SWITCH and CASE should be in the same column position.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---