mirror of
https://github.com/alibaba/DataX.git
synced 2025-05-02 22:49:47 +08:00
Update HbaseAbstractTask.java
修复hbase11xreader插件指定字段类型为boolean、short、int、long、float、double时转换失败问题,例如,当指定字段类型为int时,会报错:"exception":"offset (0)+Length (4)exceed the capacity of the array:1"
This commit is contained in:
parent
051fe821f2
commit
0cd1472bf8
@ -92,22 +92,22 @@ public abstract class HbaseAbstractTask {
|
||||
Column column;
|
||||
switch (columnType) {
|
||||
case BOOLEAN:
|
||||
column = new BoolColumn(ArrayUtils.isEmpty(byteArray) ? null : Bytes.toBoolean(byteArray));
|
||||
column = new BoolColumn(ArrayUtils.isEmpty(byteArray) ? null : Boolean.valueOf(Bytes.toString(byteArray)));
|
||||
break;
|
||||
case SHORT:
|
||||
column = new LongColumn(ArrayUtils.isEmpty(byteArray) ? null : String.valueOf(Bytes.toShort(byteArray)));
|
||||
column = new LongColumn(ArrayUtils.isEmpty(byteArray) ? null : Bytes.toString(byteArray));
|
||||
break;
|
||||
case INT:
|
||||
column = new LongColumn(ArrayUtils.isEmpty(byteArray) ? null : Bytes.toInt(byteArray));
|
||||
column = new LongColumn(ArrayUtils.isEmpty(byteArray) ? null : Integer.valueOf(Bytes.toString(byteArray)));
|
||||
break;
|
||||
case LONG:
|
||||
column = new LongColumn(ArrayUtils.isEmpty(byteArray) ? null : Bytes.toLong(byteArray));
|
||||
column = new LongColumn(ArrayUtils.isEmpty(byteArray) ? null : Long.valueOf(Bytes.toString(byteArray)));
|
||||
break;
|
||||
case FLOAT:
|
||||
column = new DoubleColumn(ArrayUtils.isEmpty(byteArray) ? null : Bytes.toFloat(byteArray));
|
||||
column = new DoubleColumn(ArrayUtils.isEmpty(byteArray) ? null : Float.valueOf(Bytes.toString(byteArray)));
|
||||
break;
|
||||
case DOUBLE:
|
||||
column = new DoubleColumn(ArrayUtils.isEmpty(byteArray) ? null : Bytes.toDouble(byteArray));
|
||||
column = new DoubleColumn(ArrayUtils.isEmpty(byteArray) ? null : Double.valueOf(Bytes.toString(byteArray)));
|
||||
break;
|
||||
case STRING:
|
||||
column = new StringColumn(ArrayUtils.isEmpty(byteArray) ? null : new String(byteArray, encoding));
|
||||
|
Loading…
Reference in New Issue
Block a user